2013-12-19 21:39:20 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// INLINE IMPLEMENTATIONS
|
|
|
|
// Created by Dan Andersson 2013
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef OYSTER_PHYSICS_3D_RIGIDBODY_INLINE_H
|
|
|
|
#define OYSTER_PHYSICS_3D_RIGIDBODY_INLINE_H
|
|
|
|
|
|
|
|
#include "RigidBody.h"
|
|
|
|
|
|
|
|
namespace Oyster { namespace Physics3D
|
|
|
|
{
|
2014-01-28 09:23:58 +01:00
|
|
|
inline void RigidBody::ApplyImpulse_Linear( const ::Oyster::Math::Float3 &worldJ )
|
2013-12-19 21:39:20 +01:00
|
|
|
{
|
|
|
|
this->impulse_Linear += worldJ;
|
|
|
|
}
|
|
|
|
|
2014-01-28 09:23:58 +01:00
|
|
|
inline void RigidBody::ApplyImpulse_Angular( const ::Oyster::Math::Float3 &worldJ )
|
2013-12-19 21:39:20 +01:00
|
|
|
{
|
|
|
|
this->impulse_Angular += worldJ;
|
|
|
|
}
|
|
|
|
|
2014-01-28 09:23:58 +01:00
|
|
|
inline void RigidBody::ApplyForce( const ::Oyster::Math::Float3 &worldF, ::Oyster::Math::Float updateFrameLength )
|
2013-12-19 21:39:20 +01:00
|
|
|
{
|
|
|
|
this->impulse_Linear += worldF * updateFrameLength;
|
|
|
|
}
|
|
|
|
|
2014-01-28 09:23:58 +01:00
|
|
|
inline void RigidBody::ApplyForce( const ::Oyster::Math::Float3 &worldF, ::Oyster::Math::Float updateFrameLength, const ::Oyster::Math::Float3 &atWorldPos )
|
2013-12-19 21:39:20 +01:00
|
|
|
{
|
|
|
|
this->ApplyImpulse( worldF * updateFrameLength, atWorldPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ::Oyster::Math::Float4x4 RigidBody::GetToWorldMatrix() const
|
|
|
|
{
|
|
|
|
return this->GetOrientation();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ::Oyster::Math::Float4x4 RigidBody::GetToLocalMatrix() const
|
|
|
|
{
|
|
|
|
return this->GetView();
|
|
|
|
}
|
|
|
|
|
2014-01-28 09:23:58 +01:00
|
|
|
inline ::Oyster::Math::Float3 RigidBody::GetSize() const
|
2013-12-19 21:39:20 +01:00
|
|
|
{
|
|
|
|
return 2.0f * this->boundingReach;
|
|
|
|
}
|
|
|
|
|
2014-01-28 09:23:58 +01:00
|
|
|
inline void RigidBody::SetSize( const ::Oyster::Math::Float3 &widthHeight )
|
2013-12-19 21:39:20 +01:00
|
|
|
{
|
|
|
|
this->boundingReach = ::Utility::Value::Abs( 0.5f * widthHeight );
|
|
|
|
}
|
|
|
|
|
2014-01-28 09:23:58 +01:00
|
|
|
//inline void RigidBody::SetForce( const ::Oyster::Math::Float3 &worldF, ::Oyster::Math::Float updateFrameLength )
|
|
|
|
//{
|
|
|
|
// this->impulse_Linear = worldF * updateFrameLength;
|
|
|
|
//}
|
2013-12-19 21:39:20 +01:00
|
|
|
|
2014-01-28 09:23:58 +01:00
|
|
|
//inline void RigidBody::SetForce( const ::Oyster::Math::Float3 &worldF, ::Oyster::Math::Float updateFrameLength, const ::Oyster::Math::Float3 &atWorldPos )
|
|
|
|
//{
|
|
|
|
// this->SetImpulse_Linear( worldF * updateFrameLength, atWorldPos );
|
|
|
|
//}
|
2013-12-19 21:39:20 +01:00
|
|
|
} }
|
|
|
|
|
|
|
|
#endif
|