|
So I'm rotating an object around a sphere using the below code:
The problem is that I don't want it to rotate along the Z axis, only the X and Y axis. How would I do this?
(comments are locked)
|
|
What you want it to do is keep the position of the target's z axis but only transform the x and y axis, like below. Oddly it doesn't seem to work. Its for the camera and I don't want it to rotate along the Z axis but that doesn't work basically at all. It doesn't look at the center of the sphere or anything.
Jul 10 '10 at 05:02 PM
ROM
you could also try 'transform.eulerAngles.z = 0;' That will make sure that the z rotation is always 0
Jul 10 '10 at 05:35 PM
Deikkan
@Deikkan - I think you want to look at Vector3(target.position.x, target.position.y, transform.position.z) to do what you are saying above. ie. project the target point into the horizontal plane containing the camera.
Jul 10 '10 at 11:59 PM
cncguy
that transform.eulerAngles.z and x stuff works the best! i highly recommend you try that before you try the above
Aug 17 '11 at 06:32 PM
IMTRIGGERHAPPY9
(comments are locked)
|
|
Thank you for this response! Its been a huge help to me.
(comments are locked)
|
