From 9a67e7ef3d27675fc12d5dd0a784bf8fec2a174f Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Fri, 20 Dec 2013 11:19:07 +0100 Subject: [PATCH] RigidBody::Move(..) added --- Code/OysterPhysics3D/RigidBody.cpp | 7 +++++++ Code/OysterPhysics3D/RigidBody.h | 1 + 2 files changed, 8 insertions(+) diff --git a/Code/OysterPhysics3D/RigidBody.cpp b/Code/OysterPhysics3D/RigidBody.cpp index e33308e2..3ae48511 100644 --- a/Code/OysterPhysics3D/RigidBody.cpp +++ b/Code/OysterPhysics3D/RigidBody.cpp @@ -82,6 +82,13 @@ void RigidBody::Predict_LeapFrog( Float4 &outDeltaPos, Float4 &outDeltaAxis, con outDeltaAxis = Formula::AngularVelocity( wMomentOfInertiaTensor.GetInverse(), AverageWithDelta(this->momentum_Angular, actingAngularImpulse) ); } +void RigidBody::Move( const Float4 &deltaPos, const Float4 &deltaAxis ) +{ + this->centerPos += deltaPos; + this->axis += deltaAxis; + this->rotation = Rotation( this->axis ); +} + void RigidBody::ApplyImpulse( const Float4 &worldJ, const Float4 &atWorldPos ) { // by Dan Andersson Float4 worldOffset = atWorldPos - this->centerPos; diff --git a/Code/OysterPhysics3D/RigidBody.h b/Code/OysterPhysics3D/RigidBody.h index 1b32c57b..a2f44480 100644 --- a/Code/OysterPhysics3D/RigidBody.h +++ b/Code/OysterPhysics3D/RigidBody.h @@ -32,6 +32,7 @@ namespace Oyster { namespace Physics3D void Update_LeapFrog( ::Oyster::Math::Float updateFrameLength ); void Predict_LeapFrog( ::Oyster::Math::Float4 &outDeltaPos, ::Oyster::Math::Float4 &outDeltaAxis, const ::Oyster::Math::Float4 &actingLinearImpulse, const ::Oyster::Math::Float4 &actingAngularImpulse, ::Oyster::Math::Float deltaTime ); + void Move( const ::Oyster::Math::Float4 &deltaPos, const ::Oyster::Math::Float4 &deltaAxis ); void ApplyImpulse( const ::Oyster::Math::Float4 &worldJ, const ::Oyster::Math::Float4 &atWorldPos ); void ApplyImpulse_Linear( const ::Oyster::Math::Float4 &worldJ ); void ApplyImpulse_Angular( const ::Oyster::Math::Float4 &worldJ );