Hello!
I’m testing unity (with a sonic like game) to see how far I can go with action game and I met some strange problem. I have a gimbal lock when my character is running upside down. The strangeness is that it’s all vector based (alignment and interpolation), not a single euler rotation is used.
Basically what I do is to apply a force along local coordinate (a transform.translate) and aligning the character to collision normal so it stay on ground (think mario galaxy).
here is an image:
The character is on a sphere. The blue trail show the path it takes. The red square show the local coordinate in world space (direct reading no conversion), the thin dark blue line show the force applied. The pale square show the contact with the ground and the cyan line show the current direction of the character (the force converted into world space).
The character is upside down, the dark blue line and the cyan line should be opposite, instead the cyan line show that the character is circling around the pole (the trail show various circle), the code does not return turn so the character is moving straight ahead in code term. If the character land on the pole it start to spin furiously.
Other problem I have that maybe is related is that the character does not jump relative to slope that are more than 90° (upside down) and camera shift upside down when in follow mode.
I have check thread about quaternion and 6dof but find nothing relevant.
You can check a build here with source code:
http://dl.dropbox.com/u/24530447/build.rar
The code is older (without transform.translate as a result of checking alternative, it use a custom moveEntity) but the result is exactly the same.
Mice control the camera around the character, left click jump, right click stop the character, left+right enter spindash mode, releasing them dash the character forward.
Set up direction with unity’s key configuration (qsdz otherwise as an azerty mapping).
The code is based on the damizean blitzengine (disclaimer inside source)
How I can solve that? Almost any project I have involve some sort of upside down magic!