From e4476f7757a79de5fee9ade50bf674584cbc5e4b Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 3 Dec 2013 15:11:13 +0100 Subject: [PATCH] Added function for ICustomBody void ICustomBody::SetMomentum( const ::Oyster::Math::Float3 &worldG ) - Added and implemented --- Code/GamePhysics/Implementation/SimpleRigidBody.cpp | 5 +++++ Code/GamePhysics/Implementation/SimpleRigidBody.h | 1 + Code/GamePhysics/Implementation/SphericalRigidBody.cpp | 5 +++++ Code/GamePhysics/Implementation/SphericalRigidBody.h | 1 + Code/GamePhysics/PhysicsAPI.h | 6 ++++++ 5 files changed, 18 insertions(+) diff --git a/Code/GamePhysics/Implementation/SimpleRigidBody.cpp b/Code/GamePhysics/Implementation/SimpleRigidBody.cpp index 70bc6938..ea75ffe3 100644 --- a/Code/GamePhysics/Implementation/SimpleRigidBody.cpp +++ b/Code/GamePhysics/Implementation/SimpleRigidBody.cpp @@ -177,4 +177,9 @@ void SimpleRigidBody::SetOrientation( const Float4x4 &orientation ) void SimpleRigidBody::SetSize( const Float3 &size ) { this->rigid.SetSize( size ); +} + +void SimpleRigidBody::SetMomentum( const Float3 &worldG ) +{ + this->rigid.SetLinearMomentum( worldG ); } \ No newline at end of file diff --git a/Code/GamePhysics/Implementation/SimpleRigidBody.h b/Code/GamePhysics/Implementation/SimpleRigidBody.h index a674a20d..5e05c9d7 100644 --- a/Code/GamePhysics/Implementation/SimpleRigidBody.h +++ b/Code/GamePhysics/Implementation/SimpleRigidBody.h @@ -41,6 +41,7 @@ namespace Oyster { namespace Physics void SetRotation( const ::Oyster::Math::Float4x4 &rotation ); void SetOrientation( const ::Oyster::Math::Float4x4 &orientation ); void SetSize( const ::Oyster::Math::Float3 &size ); + void SetMomentum( const ::Oyster::Math::Float3 &worldG ); private: ::Oyster::Physics3D::RigidBody rigid; diff --git a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp index c741a68a..03ed7d2a 100644 --- a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp +++ b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp @@ -183,4 +183,9 @@ void SphericalRigidBody::SetSize( const Float3 &size ) { this->rigid.SetSize( size ); this->body.radius = 0.5f * Min( Min( size.x, size.y ), size.z ); // inline Min( FloatN )? +} + +void SphericalRigidBody::SetMomentum( const Float3 &worldG ) +{ + this->rigid.SetLinearMomentum( worldG ); } \ No newline at end of file diff --git a/Code/GamePhysics/Implementation/SphericalRigidBody.h b/Code/GamePhysics/Implementation/SphericalRigidBody.h index 37263e91..a25cba2c 100644 --- a/Code/GamePhysics/Implementation/SphericalRigidBody.h +++ b/Code/GamePhysics/Implementation/SphericalRigidBody.h @@ -42,6 +42,7 @@ namespace Oyster { namespace Physics void SetRotation( const ::Oyster::Math::Float4x4 &rotation ); void SetOrientation( const ::Oyster::Math::Float4x4 &orientation ); void SetSize( const ::Oyster::Math::Float3 &size ); + void SetMomentum( const ::Oyster::Math::Float3 &worldG ); private: ::Oyster::Physics3D::RigidBody rigid; diff --git a/Code/GamePhysics/PhysicsAPI.h b/Code/GamePhysics/PhysicsAPI.h index 29014214..56e46817 100644 --- a/Code/GamePhysics/PhysicsAPI.h +++ b/Code/GamePhysics/PhysicsAPI.h @@ -390,6 +390,12 @@ namespace Oyster * Use API::SetSize(...) ********************************************************/ virtual void SetSize( const ::Oyster::Math::Float3 &size ) = 0; + + /******************************************************** + * To not be called if is in Engine + * Use API::?? @todo TODO: + ********************************************************/ + virtual void SetMomentum( const ::Oyster::Math::Float3 &worldG ) = 0; }; struct API::SimpleBodyDescription