diff --git a/src/main.rs b/src/main.rs index 0061571..c424d12 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,8 @@ mod util; mod mesh; mod scene_graph; use scene_graph::SceneNode; +mod toolbox; +use toolbox::simple_heading_animation; use glutin::event::{ DeviceEvent, @@ -438,6 +440,16 @@ fn main() { let projection: glm::Mat4 = glm::perspective(window_aspect_ratio, std::f32::consts::PI / 4.0, 1.0, 1000.0); + // Animate helicopter root via simple_heading_animation + let heading = simple_heading_animation(elapsed); + { + let mut hr_pin = heli_root.as_mut(); + unsafe { + let node = hr_pin.get_unchecked_mut(); + node.position = glm::vec3(heading.x, 0.0, heading.z); + node.rotation = glm::vec3(heading.roll, heading.pitch, heading.yaw); + } + } // Update rotor rotations { let mut mr_pin = main_rotor_node.as_mut();