14 releases

new 0.5.0 Feb 25, 2024
0.4.2 Jun 1, 2023
0.4.1 Feb 27, 2023
0.4.0 Oct 24, 2022
0.1.4 Nov 14, 2021

#130 in Game dev

Download history 252/week @ 2023-11-05 245/week @ 2023-11-12 226/week @ 2023-11-19 243/week @ 2023-11-26 332/week @ 2023-12-03 240/week @ 2023-12-10 157/week @ 2023-12-17 174/week @ 2023-12-24 169/week @ 2023-12-31 262/week @ 2024-01-07 305/week @ 2024-01-14 277/week @ 2024-01-21 232/week @ 2024-01-28 309/week @ 2024-02-04 343/week @ 2024-02-11 552/week @ 2024-02-18

1,495 downloads per month
Used in nanogltf

MIT/Apache

32KB
765 lines

🎥 dolly

Crates.io Docs

Combine simple building blocks to create smooth cameras: first-person, chase, orbit, look-at, you name it!

Camera rigs made with dolly are engine-agnostic, and only provide camera positioning. Optical and rendering parameters such as field of view and clipping planes can be built on top, and are not within the scope of this crate.

While cameras are a complex topic in gamedev, this crate only provides the basics, aiming at small games and tools.

Example

orbit camera example

let mut camera: CameraRig = CameraRig::builder()
    .with(YawPitch::new().yaw_degrees(45.0).pitch_degrees(-30.0))
    .with(Smooth::new_rotation(1.5))
    .with(Arm::new(Vec3::Z * 4.0))
    .build();

// ...

let camera_driver = camera.driver_mut::<YawPitch>();
if keyboard.was_just_pressed(VirtualKeyCode::Z) {
    camera_driver.rotate_yaw_pitch(-90.0, 0.0);
}
if keyboard.was_just_pressed(VirtualKeyCode::X) {
    camera_driver.rotate_yaw_pitch(90.0, 0.0);
}

camera.update(time_delta_seconds);

Dependencies

~2.5MB
~83K SLoC