Skip to main content

Crate orbit_camera

Crate orbit_camera 

Source
Expand description

A third-person orbit camera.

The camera orbits a focus point that smoothly follows a target. Yaw and pitch are controlled directly; the orbit distance scales with pitch (looking down pulls the camera in, looking up pushes it out) and can be zoomed. The focus point and distance interpolate frame-rate independently. An optional clipping pass pulls the camera in when geometry blocks the line of sight to the focus.

The camera produces geometry (eye, focus, up) and projection parameters; it does not depend on any matrix type. Build the view-projection matrix with whatever math library the renderer uses.

use ga3::Vector;
use orbit_camera::OrbitCamera;

let mut camera = OrbitCamera::new(Vector::new(0.0, 0.0, 0.0));
camera.rotate([0.02, 0.0]);
camera.follow(Vector::new(1.0, 0.0, 0.0), 1.0 / 60.0);
let view = camera.view();
let _eye = view.eye;

Structs§

CameraConfig
Tunable parameters of an OrbitCamera.
MovementBasis
The horizontal movement basis derived from the camera yaw.
OrbitCamera
A third-person camera that orbits a smoothly following focus point.
ViewParameters
Everything needed to build a view-projection matrix.

Traits§

Clip
A source of geometry the camera can clip against.