# RotateAround and Gimbal lock

 0 Hi guys, I know there is plenty of post about this but I can't find any of those that fix our problem.We have a basically a box that we want to rotate around a sphere just like it walk on it. We are using RotateAround to do so and it seems to work fine until we get to the other side of the sphere (we start on top of it). At this point, we seems to experiment the Gimbal lock problem. I thought Unity was already handling this with RotateAround but it doesn't looks like it. ``````//This part is done everytime there is an input Vector2 deltaNorm = delta; deltaNorm.Normalize(); Vector3 moveAxis = transform.TransformDirection(Vector3.right) * deltaNorm.y * -1.0f + transform.TransformDirection(Vector3.forward) * deltaNorm.x * 1.0f; moveAxis.Normalize(); mMoveAxis = moveAxis; mMoveAngle = delta.magnitude; //This part is done in FixedUpdate() transform.RotateAround(Vector3.zero, mMoveAxis, 1.0f * Time.deltaTime * mMoveAngle); Vector3 newPosition = transform.position; newPosition.Normalize(); transform.up = newPosition; newPosition *= sphereInitialRadius * sphere.localScale.x; transform.position = newPosition; ``````Our box has a RigidBody.So we want to know how to make the box go forward even when we are at the "bottom" of the sphere.Thanks for you input more ▼ asked Sep 02 '11 at 04:21 PM cakeby 1 ● 2 ● 2 ● 3 I'd draw a debug line for that mMoveAxis - are you certain it's right? Sep 02 '11 at 10:26 PM Waz add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

Be the first one to answer this question

By Email:

Topics:

asked: Sep 02 '11 at 04:21 PM

Seen: 743 times

Last Updated: Sep 02 '11 at 10:26 PM