Added some data to PhysicsAPI

GetRigidLinearVelocity() and void* as reference to game object.
This commit is contained in:
Robin Engman 2013-12-12 10:02:35 +01:00
parent 5835a72acc
commit c740bd5935
6 changed files with 23 additions and 0 deletions

Binary file not shown.

View File

@ -124,6 +124,12 @@ Float4x4 & SimpleRigidBody::GetView( Float4x4 &targetMem ) const
return targetMem = this->rigid.GetView(); return targetMem = this->rigid.GetView();
} }
Float3 SimpleRigidBody::GetRigidLinearVelocity() const
{
return this->rigid.GetLinearVelocity();
}
UpdateState SimpleRigidBody::Update( Float timeStepLength ) UpdateState SimpleRigidBody::Update( Float timeStepLength )
{ {
this->rigid.Update_LeapFrog( timeStepLength ); this->rigid.Update_LeapFrog( timeStepLength );

View File

@ -18,6 +18,7 @@ namespace Oyster { namespace Physics
State GetState() const; State GetState() const;
State & GetState( State &targetMem ) const; State & GetState( State &targetMem ) const;
void SetState( const State &state ); void SetState( const State &state );
::Oyster::Math::Float3 GetRigidLinearVelocity() const;
void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter ); void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter );
bool IsAffectedByGravity() const; bool IsAffectedByGravity() const;

View File

@ -126,6 +126,11 @@ Float4x4 & SphericalRigidBody::GetView( Float4x4 &targetMem ) const
return targetMem = this->rigid.GetView(); return targetMem = this->rigid.GetView();
} }
Float3 SphericalRigidBody::GetRigidLinearVelocity() const
{
return this->rigid.GetLinearVelocity();
}
UpdateState SphericalRigidBody::Update( Float timeStepLength ) UpdateState SphericalRigidBody::Update( Float timeStepLength )
{ {
this->rigid.Update_LeapFrog( timeStepLength ); this->rigid.Update_LeapFrog( timeStepLength );

View File

@ -19,6 +19,7 @@ namespace Oyster { namespace Physics
State GetState() const; State GetState() const;
State & GetState( State &targetMem = State() ) const; State & GetState( State &targetMem = State() ) const;
void SetState( const State &state ); void SetState( const State &state );
::Oyster::Math::Float3 GetRigidLinearVelocity() const;
void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter ); void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter );
bool IsAffectedByGravity() const; bool IsAffectedByGravity() const;

View File

@ -243,6 +243,11 @@ namespace Oyster
SubscriptMessage_ignore_collision_response SubscriptMessage_ignore_collision_response
}; };
/********************************************************
* @param gameObjectRef: a pointer to the object in the game owning the rigid body.
********************************************************/
void* gameObjectRef;
typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter ); typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
typedef Struct::SimpleBodyDescription SimpleBodyDescription; typedef Struct::SimpleBodyDescription SimpleBodyDescription;
typedef Struct::SphericalBodyDescription SphericalBodyDescription; typedef Struct::SphericalBodyDescription SphericalBodyDescription;
@ -271,6 +276,11 @@ namespace Oyster
********************************************************/ ********************************************************/
virtual State & GetState( State &targetMem ) const = 0; virtual State & GetState( State &targetMem ) const = 0;
/********************************************************
* @return the linear velocity of the rigid body in a vector.
********************************************************/
virtual Math::Float3 GetRigidLinearVelocity() const = 0;
/******************************************************** /********************************************************
* @todo TODO: need doc * @todo TODO: need doc
********************************************************/ ********************************************************/