Skip to menu

Robotics with Object Pascal

Rover written with RUST

To change the camera view point on GL

2025.11.10 01:54

me Views:32

To change that initial view, you need to modify the camera_target line.

If your camera is at (0.0, 500.0, 3000.0) and you want to look 30 degrees to the right (pivoting around the camera's Y-axis), you need to shift your target point to the right along the X-axis.

The calculation is: tan(30°) = opposite / adjacent tan(30°) = new_x / 3000.0 new_x = 3000.0 * tan(30°) new_x = 3000.0 * 0.577 new_x ≈ 1732.0

 

The Code Change

 

Change this line:

   let camera_target = Point3::new(1732.0, 0.0, 0.0);