, where LookTo is a number 0, 1, 2…, 7. Zero is a look to the north, 1 - to the north-east and seven - north-west; RDir - rotation direction, 1 or -1 (in real this code bigger for smooth rotation, but this is principal part to set position).
So, when i multiply 45 deegres (Pi*0.25) to 0-7, i get angle of rotation. It works nice with minimap TCastleTransforms.
But it work wrong with camera in 3D scene: only .LookTo := 7, 1 or 0 can set camera to the right position, other values don’t move they. I observe to .LookTo and radians calculation in console, howewer they are ok. Moreover, minimap use this variables too and work like they must, but camera freezed between .LookTo 1 and 7.
I maked simple procedure for set camera inside .Update:
procedure CameraRotation(var Viewport: TCastleViewport; var Player: THero);
Viewport.Camera.Direction := Vector3(-Pi * 0.25 * Player.LookTo, 0, 0);
This is results in console: (.LookTo / radians; Camera doesn’t change position between 1 and 7):
Sometimes i incorrectly understand documentation… Must take more time to English learning
So, i think to use .Rotation to camera, because it will allow use same procedure for two Viewports - minimap and environment observer… Or .Direction can take something benefits in compare with .Rotation in my case?