Camera setting in radians

This isn’t the way to apply your LookTo value.

The Camera.Direction (actually TCastleTransform.Direction) is a direction along which the camera is looking at.

See Castle Game Engine: CastleTransform: Class TCastleTransform ,

Rotate using Rotation. The rotation is performed around the Center point. The rotation may be alternatively controlled using the Direction and Up vectors.

See also Direction docs: Castle Game Engine: CastleTransform: Class TCastleTransform . In particular,

The Direction and Up vectors should always be normalized (have length 1). When setting them by these properties, we will normalize them automatically.

So all the instructions doing

Camera.Direction := Vector3(something, 0, 0)

are really equivalent to just

Camera.Direction := Vector3(1, 0, 0)

To set the direction like you want:

  1. Calculate direction x and y components from your angle. Similar to what we shown in other thread ( Calculation of objects positions with using sine and cosine - #2 by eugeneloza ) – use SinCos on the angle derived from LookTo (like StartingAngle), sinus goes to X, cosinus goes to Y.

  2. Or, set Camera.Rotation, and then you can rotate it quite similarly to what you do with Map.MapCanvas.Rotation you show.

1 Like