From c4bbc09a97cf8453b00d49e6861db0599ad57171 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Fri, 20 Dec 2013 11:13:44 +0100 Subject: [PATCH] CustomBodyState::ApplyForwarding(..) added --- Code/GamePhysics/PhysicsStructs-Impl.h | 28 +++++++++++++++++++++++++- Code/GamePhysics/PhysicsStructs.h | 7 ++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Code/GamePhysics/PhysicsStructs-Impl.h b/Code/GamePhysics/PhysicsStructs-Impl.h index e48ede8d..e7704460 100644 --- a/Code/GamePhysics/PhysicsStructs-Impl.h +++ b/Code/GamePhysics/PhysicsStructs-Impl.h @@ -41,7 +41,8 @@ namespace Oyster { namespace Physics this->linearMomentum = linearMomentum; this->angularMomentum = angularMomentum; this->linearImpulse = this->angularImpulse = ::Oyster::Math::Float4::null; - this->isSpatiallyAltered = this->isDisturbed = false; + this->deltaPos = this->deltaAxis = ::Oyster::Math::Float4::null; + this->isSpatiallyAltered = this->isDisturbed = this->isForwarded = false; } inline CustomBodyState & CustomBodyState::operator = ( const CustomBodyState &state ) @@ -58,8 +59,11 @@ namespace Oyster { namespace Physics this->angularMomentum = state.angularMomentum; this->linearImpulse = state.linearImpulse; this->angularImpulse = state.angularImpulse; + this->deltaPos = state.deltaPos; + this->deltaAxis = state.deltaAxis; this->isSpatiallyAltered = state.isSpatiallyAltered; this->isDisturbed = state.isDisturbed; + this->isForwarded = state.isForwarded; return *this; } @@ -149,6 +153,16 @@ namespace Oyster { namespace Physics return this->angularImpulse; } + inline const ::Oyster::Math::Float4 & CustomBodyState::GetForward_DeltaPos() const + { + return this->deltaPos; + } + + inline const ::Oyster::Math::Float4 & CustomBodyState::GetForward_DeltaAxis() const + { + return this->deltaAxis; + } + inline void CustomBodyState::SetMass_KeepMomentum( ::Oyster::Math::Float m ) { this->mass = m; @@ -287,6 +301,13 @@ namespace Oyster { namespace Physics this->isDisturbed = true; } + inline void CustomBodyState::ApplyForwarding( const ::Oyster::Math::Float4 &deltaPos, const ::Oyster::Math::Float4 &deltaAxis ) + { + this->deltaPos += deltaPos; + this->deltaAxis += deltaAxis; + this->isDisturbed = this->isForwarded = true; + } + inline bool CustomBodyState::IsSpatiallyAltered() const { return this->isSpatiallyAltered; @@ -296,6 +317,11 @@ namespace Oyster { namespace Physics { return this->isDisturbed; } + + inline bool CustomBodyState::IsForwarded() const + { + return this->isForwarded; + } } } } diff --git a/Code/GamePhysics/PhysicsStructs.h b/Code/GamePhysics/PhysicsStructs.h index 96ec1f14..3c17ae6d 100644 --- a/Code/GamePhysics/PhysicsStructs.h +++ b/Code/GamePhysics/PhysicsStructs.h @@ -66,6 +66,8 @@ namespace Oyster { namespace Physics const ::Oyster::Math::Float4 & GetAngularMomentum() const; const ::Oyster::Math::Float4 & GetLinearImpulse() const; const ::Oyster::Math::Float4 & GetAngularImpulse() const; + const ::Oyster::Math::Float4 & GetForward_DeltaPos() const; + const ::Oyster::Math::Float4 & GetForward_DeltaAxis() const; void SetMass_KeepMomentum( ::Oyster::Math::Float m ); void SetMass_KeepVelocity( ::Oyster::Math::Float m ); @@ -90,9 +92,11 @@ namespace Oyster { namespace Physics void ApplyLinearImpulse( const ::Oyster::Math::Float4 &j ); void ApplyAngularImpulse( const ::Oyster::Math::Float4 &j ); void ApplyImpulse( const ::Oyster::Math::Float4 &j, const ::Oyster::Math::Float4 &at, const ::Oyster::Math::Float4 &normal ); + void ApplyForwarding( const ::Oyster::Math::Float4 &deltaPos, const ::Oyster::Math::Float4 &deltaAxis ); bool IsSpatiallyAltered() const; bool IsDisturbed() const; + bool IsForwarded() const; private: ::Oyster::Math::Float mass, restitutionCoeff, staticFrictionCoeff, kineticFrictionCoeff; @@ -100,8 +104,9 @@ namespace Oyster { namespace Physics ::Oyster::Math::Float4 reach, centerPos, angularAxis; ::Oyster::Math::Float4 linearMomentum, angularMomentum; ::Oyster::Math::Float4 linearImpulse, angularImpulse; + ::Oyster::Math::Float4 deltaPos, deltaAxis; // Forwarding data sum - bool isSpatiallyAltered, isDisturbed; + bool isSpatiallyAltered, isDisturbed, isForwarded; }; } } }