Partial SimpleRigid update

This commit is contained in:
Dander7BD 2013-12-20 11:15:43 +01:00
parent c4bbc09a97
commit 604a17056c
2 changed files with 17 additions and 3 deletions

View File

@ -47,18 +47,19 @@ SimpleRigidBody::SimpleRigidBody()
this->rigid.SetMass_KeepMomentum( 16.0f ); this->rigid.SetMass_KeepMomentum( 16.0f );
this->gravityNormal = Float3::null; this->gravityNormal = Float3::null;
this->collisionAction = Default::EventAction_Collision; this->collisionAction = Default::EventAction_Collision;
this->ignoreGravity = false; this->ignoreGravity = this->isForwarded = false;
this->scene = nullptr; this->scene = nullptr;
} }
SimpleRigidBody::SimpleRigidBody( const API::SimpleBodyDescription &desc ) SimpleRigidBody::SimpleRigidBody( const API::SimpleBodyDescription &desc )
{ {
this->rigid = RigidBody();
this->rigid.SetRotation( desc.rotation ); this->rigid.SetRotation( desc.rotation );
this->rigid.centerPos = desc.centerPosition; this->rigid.centerPos = desc.centerPosition;
this->rigid.SetSize( desc.size ); this->rigid.SetSize( desc.size );
this->rigid.SetMass_KeepMomentum( desc.mass ); this->rigid.SetMass_KeepMomentum( desc.mass );
this->rigid.SetMomentOfInertia_KeepMomentum( desc.inertiaTensor ); this->rigid.SetMomentOfInertia_KeepMomentum( desc.inertiaTensor );
this->deltaPos = Float4::null;
this->deltaAxis = Float4::null;
this->gravityNormal = Float3::null; this->gravityNormal = Float3::null;
@ -113,6 +114,13 @@ void SimpleRigidBody::SetState( const SimpleRigidBody::State &state )
this->rigid.frictionCoeff_Static = state.GetFrictionCoeff_Static(); this->rigid.frictionCoeff_Static = state.GetFrictionCoeff_Static();
this->rigid.frictionCoeff_Kinetic = state.GetFrictionCoeff_Kinetic(); this->rigid.frictionCoeff_Kinetic = state.GetFrictionCoeff_Kinetic();
if( state.IsForwarded() )
{
this->deltaPos += state.GetForward_DeltaPos();
this->deltaAxis += state.GetForward_DeltaAxis();
this->isForwarded;
}
if( this->scene ) if( this->scene )
{ {
if( state.IsSpatiallyAltered() ) if( state.IsSpatiallyAltered() )
@ -243,6 +251,11 @@ Float3 SimpleRigidBody::GetRigidLinearVelocity() const
UpdateState SimpleRigidBody::Update( Float timeStepLength ) UpdateState SimpleRigidBody::Update( Float timeStepLength )
{ {
if( this->isForwarded )
{
// this->rigid.
}
this->rigid.Update_LeapFrog( timeStepLength ); this->rigid.Update_LeapFrog( timeStepLength );
// compare previous and new state and return result // compare previous and new state and return result

View File

@ -53,10 +53,11 @@ namespace Oyster { namespace Physics
private: private:
::Oyster::Physics3D::RigidBody rigid; ::Oyster::Physics3D::RigidBody rigid;
::Oyster::Math::Float4 deltaPos, deltaAxis;
::Oyster::Math::Float3 gravityNormal; ::Oyster::Math::Float3 gravityNormal;
EventAction_Collision collisionAction; EventAction_Collision collisionAction;
Octree *scene; Octree *scene;
bool ignoreGravity; bool ignoreGravity, isForwarded;
}; };
} } } }