Spherical travel and gimbal lock madness

Blitz3D Forums/Blitz3D Programming/Spherical travel and gimbal lock madness

Krischan(Posted 2014) [#1]
I want to drive at constant speed on a sphere and without gimbal lock on the poles but I don't get it - it turns me mad. Imagine yourself in a vehicle driving over earth's surface and want to go from the USA to Russia - you wouldn't stop or turn around at the pole(s) or become faster there.

But how? I'm stuck and need some help. I turned 40 this year - I'm getting too old for such things?

Here is a small example, use the texture below as media "earth.jpg" and the cursor keys to drive around.



MiniB3D version:




Oh, by the way. My current planet looks a little more polished than this example but suffers from the same problem, it's a part of my current project (click image for large resolution)



Krischan(Posted 2014) [#2]
Ok, solved it using quaternions. Now you can drive around on a sphere like in a car which really makes fun, woo-hoo! However, there is a small limitation in Blitz3D because of the "low" accuracy - a blackout or a stuttering effect at the poles.

In miniB3D I could avoid it increasing the accuracy to doubles and using a incredible small value (1.0/2^512 vs. 1.0/2^64). Credits for the nice and handy Quaternion rotation code goes to Markus2 from the german Blitzforum.

Blitz3D:


MiniB3D:



Rroff(Posted 2014) [#3]
IIRC (been awhile since I played with it) for B3D and large scale stuff you have to reset so the player position is around 0,0,0 for rendering - I think if you want you can do all the update stuff with the world in its normal position especially if your using a 3rd party physics engine then move it temporary when rendering then move it back. I've not really played with it too extensively though.


RGR(Posted 2014) [#4]
Edit..