Camera rotates if pointing bottom-up instead of tilting
-
To use the nice 3D background with the heaven and the clouds (
setEnvironment(2, ...)
) I put the camera position bottom-up (in this direction, there are less clouds).
To make the 3D title view looking nicer, I wanted to move the camera view direction a bit to the right or left. Instead of just changing the view on the 3D letters, the camera starts rotating.
In the second part of the video you see how the letters change, if I increase X:
I expected the letters just to tilt a bit, not to flip 90 degrees. Any idea why the camera view is doing this?
-
I think your experiencing gimbal lock. It happens when your looking straight up. It's caused by being too close to 0 on two axis. Probably fix by moving your model away from one of the axis. Google gimbal lock for more.
-
The camera flips over while going from in front of an object to behind it. It’s to keep the camera upright with regards to game space. Putting the camera pointing straight up probably puts it exactly half way through a flip. 90 degrees..
-
Thanks, for your ideas.
@xevdev This is probably what happens, if I set z from -0.01 for the direction to 0. Then the background and the model disappears. Just a blackscreen is seen.
@toxibunny I feel like this seems to be the reason. Then I will need to workaround, by not using the background or the built in camera. -
@xevdev It is definitively the gimbal lock. The predfined rotation-order is defining the plane x-z as the ground. I found a good video about that
-
@spikey couldn't you clamp a point so it wouldn't reach that point
-
@waldron yeah, I was thinking too about just avoiding the point where z and x is zero. But beside the effect that the whole scene disappears at that point, the camera path is making a curve combined with a rotation, when I only get close to that point.
-
But basically, nobody will probably ever place the camera like this. Its a selfmade problem, so I just hope this thread saves others some time. For me it was good to hear some thoughts about it. Maybe the setenvironment command could be used more often, when the image could be positioned.
-
There are requests to be able to tilt the camera, so maybe this will be a non-issue sometime soon. It is quite an edge use case you’ve found though :P
-
You'll see this if you try a flight sim and it's annoying. I think think the only way around it is by using quaternions and vector math. And that's a lot of maths to chug through every frame.
-
how about a box that moves in as fake sky or clouds as you reach that point i know its masking the problem but possible work around.