From caa53fdb593ca588a3a958bb8a85007b1bf3b52a Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 19 Mar 2024 16:14:12 +0100 Subject: [PATCH] implement rotation of objects --- src/actor.rs | 19 ++++++++++++++++--- src/world.rs | 5 ++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 6b292e4..9a1cc7b 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -10,7 +10,10 @@ impl Plugin for ActorPlugin { app.add_systems(Startup, setup); app.register_type::(); app.register_type::(); - app.add_systems(FixedUpdate, update); + app.add_systems(FixedUpdate, ( + update_physics_lifeforms, + update_physics_actors, + )); app.add_systems(Update, ( handle_new_conversations, handle_conversations, @@ -30,7 +33,7 @@ pub struct Actor { pub hp: f32, pub m: f32, // mass pub v: Vec3, // velocity - // TODO: rotation + pub angular_momentum: Quat, } impl Default for Actor { @@ -39,6 +42,7 @@ impl Default for Actor { hp: 100.0, m: 100.0, v: Vec3::ZERO, + angular_momentum: Quat::from_euler(EulerRot::XYZ, 0.001, 0.01, 0.003), } } } @@ -118,7 +122,16 @@ pub fn setup( }); } -pub fn update( +pub fn update_physics_actors( + time: Res