From 595cdfd51594af7cee4258a1ed92b06c6bf0171d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 11 Feb 2026 17:27:59 +0100 Subject: Fixing --- lib/core/c++/particle/particle.hpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib/core/c++/particle') diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp index 8509df6..a82b12d 100644 --- a/lib/core/c++/particle/particle.hpp +++ b/lib/core/c++/particle/particle.hpp @@ -35,7 +35,7 @@ using ParticleRigidBody = Struct< Member::Schema, "rotation_old">, Member, "acceleration">, - Member::Schema, "rotational_acceleration"> + Member::Schema, "angular_acceleration"> >; template @@ -109,8 +109,12 @@ constexpr auto verlet_step_lambda = [](saw::data>& particle, auto& pos = body.template get<"position">(); auto& pos_old = body.template get<"position_old">(); + auto& pos_acc = body.template get<"acceleration">(); + auto& rot = body.template get<"rotation">(); - auto& acc = body.template get<"acceleration">(); + auto& rot_old = body.template get<"rotation_old">(); + + auto& rot_acc = body.template get<"angular_acceleration">(); auto tsd_squared = time_step_delta * time_step_delta; @@ -118,10 +122,18 @@ constexpr auto verlet_step_lambda = [](saw::data>& particle, // Actual step saw::data> two; two.at({}).set(2.0); - pos_new = pos * two - pos_old + acc * tsd_squared; + pos_new = pos * two - pos_old + pos_acc * tsd_squared; + + // Angular + saw::data::Schema> rot_new; + rot_new = rot * two - rot_old + rot_acc * tsd_squared; + // Swap - Could be std::swap? pos_old = pos; pos = pos_new; + + rot_old = rot; + rot = rot_new; }; template -- cgit v1.2.3