Ok, so I have a central object (an arrow) that rotates around a circle, pointing towards the direction the camera is facing. I have an empty gameObject parented to the center of the camera as a reference Vector3 to look towards. The arrow is a Sprite, so it’s only supposed to be rotating on the Z-axis. Using a few snippets I found, I managed to get it working perfectly with this:
var newRotation : Quaternion = Quaternion.LookRotation(facingVel.transform.position - cursorObj.transform.position, Vector3.forward);
newRotation.x = 0.0;
newRotation.y = 0.0;
facingVel.transform.localRotation = newRotation;
The problem I have now is that the player object must be able to rotate, however as soon as the player isn’t at 0,0,0 rotation, this throws off the above code and the arrow begins drifting, due to the position of the target in world space. The arrow is also parented to something, if that helps.
Any ideas?
EDIT:
I still haven’t found the solution, however after exposing some of the values, I’ve noticed that the Z and W components of the newRotation variable change significantly as the player object is rotating.