In the tutorial section there is a tutorial about using Pitch, Roll and turn on GLScene objects. This tutorial explains the problems with gimbal lock which occurs when you change more that one of the three angle axis (Turn, Pitch and roll).
A simple trick is to make use of dummy cubes to construct a tripot. We start with the base cube. This TDummyCube is used to position the camera in the scene. The base cube can also be used to turn the camera (Rotate about the green Y axis).
Now we add a child TDummyCube to the base cube. Lets call this the pitch cube. This Pitch cube is exclusivly used to only pitch the camera up and down. Finally you add the camera which will be a child to the Pitch cube.
A simple trick is to make use of dummy cubes to construct a tripot. We start with the base cube. This TDummyCube is used to position the camera in the scene. The base cube can also be used to turn the camera (Rotate about the green Y axis).
Now we add a child TDummyCube to the base cube. Lets call this the pitch cube. This Pitch cube is exclusivly used to only pitch the camera up and down. Finally you add the camera which will be a child to the Pitch cube.
Here the geen cube is the basecube to which position instructions and turn instructions are given. The Red cube is the pitch cube which is used only to change the pitch angle. The arrow in the image represents the camera pointing direction which is added for visualisation purposes.
Tip Note the light attached to the camera. This way it is always where you want it and pointing where the camera points. Make sure to use a position offset for the light to improve the surface shading contrast
To move the camera, turn it towards the subject and pitch it up you code this:
BaseCube.Position.X := BaseCube.Position.X + 1; BaseCube.TurnAngle := BaseCube.TurnAngle + 1; PitchCube.PitchAngle := PitchCube.PitchAngle + 1;
Author Eric Grange
No hay comentarios:
Publicar un comentario