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§
- Camera
Config - Tunable parameters of an
OrbitCamera. - Movement
Basis - The horizontal movement basis derived from the camera yaw.
- Orbit
Camera - A third-person camera that orbits a smoothly following focus point.
- View
Parameters - Everything needed to build a view-projection matrix.
Traits§
- Clip
- A source of geometry the camera can clip against.