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;
Vector3 moveAxis = transform.TransformDirection(Vector3.right) * deltaNorm.y * -1.0f + transform.TransformDirection(Vector3.forward) * deltaNorm.x * 1.0f;
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;
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
Sep 02 '11 at 04:21 PM