- Home /
Rigidbody rotation problem when upside down
My game includes having my character walking around a planet (and obviously there is gravity simulation meaning the player 'orbits' the planet). He walks absolutely fine when most places on the planet, but spins around at the bottom of the planet (south pole). You also become sort of 'stuck' (it is possible to get out - but a user shouldn't need to experience this when playing the game).
I am not sure how well I can explain this, so I took a video and uploaded it to youtube: rigidbody rotation problem upsidedown
In the video, the first 15 seconds shows me walking to the bottom of the sphere (the lighting is coming from the bottom of the world) - then at 0:15 you can clearly see what I am talking about, and what I want to prevent.
Can anyone help?
Answer by crogers · Jul 13, 2012 at 09:57 PM
Gravity in most all physics system is one direction (down). Maybe changing the direction of the gravity as the character walks around the planet would do what you want?
I am not using the PhysX gravity, I have it coded in myself. Also the gravity isn't the problem, the problem is the spinning when the player gets to the bottom of the sphere.
I just reread the original question and realised how ambiguous it was. I have adjusted it to make more sense.
is "gimbal lock" the problem? does the spinning happen around one axis?
i'm not a math-ish type programmer, but dealing with rotations in quaternions ins$$anonymous$$d of euler angles would probably help. the trick animator's use to get around gimbal lock is to animate a node above the problem node, rotating the parent in such a way (moves the axis out of the way) that the child rotates correctly. not a good explanation but maybe that helps
Yep. You have gimbal lock on the Y. $$anonymous$$ost 3d programs hold the Y axis as true up and down so when at the Y and looking up or down you spin like a compass needle.
Your answer