Merge remote-tracking branch 'origin/Physics' into Sprint3
This commit is contained in:
commit
24a6e7478e
|
@ -116,7 +116,7 @@ SimpleRigidBody::State & SimpleRigidBody::GetState( SimpleRigidBody::State &targ
|
||||||
void SimpleRigidBody::SetState( const SimpleRigidBody::State &state )
|
void SimpleRigidBody::SetState( const SimpleRigidBody::State &state )
|
||||||
{
|
{
|
||||||
this->rigid.centerPos = state.GetCenterPosition();
|
this->rigid.centerPos = state.GetCenterPosition();
|
||||||
this->rigid.SetRotation( state.GetRotation() );
|
//this->rigid.SetRotation( state.GetRotation() ); //! HACK: @todo Rotation temporary disabled
|
||||||
this->rigid.boundingReach = state.GetReach();
|
this->rigid.boundingReach = state.GetReach();
|
||||||
this->rigid.momentum_Linear = state.GetLinearMomentum();
|
this->rigid.momentum_Linear = state.GetLinearMomentum();
|
||||||
this->rigid.momentum_Angular = state.GetAngularMomentum();
|
this->rigid.momentum_Angular = state.GetAngularMomentum();
|
||||||
|
|
|
@ -84,7 +84,7 @@ SphericalRigidBody::State & SphericalRigidBody::GetState( SphericalRigidBody::St
|
||||||
void SphericalRigidBody::SetState( const SphericalRigidBody::State &state )
|
void SphericalRigidBody::SetState( const SphericalRigidBody::State &state )
|
||||||
{
|
{
|
||||||
this->rigid.centerPos = state.GetCenterPosition();
|
this->rigid.centerPos = state.GetCenterPosition();
|
||||||
this->rigid.SetRotation( state.GetRotation() );
|
//this->rigid.SetRotation( state.GetRotation() ); //! HACK: @todo Rotation temporary disabled
|
||||||
this->rigid.boundingReach = state.GetReach();
|
this->rigid.boundingReach = state.GetReach();
|
||||||
this->rigid.momentum_Linear = state.GetLinearMomentum();
|
this->rigid.momentum_Linear = state.GetLinearMomentum();
|
||||||
this->rigid.momentum_Angular = state.GetAngularMomentum();
|
this->rigid.momentum_Angular = state.GetAngularMomentum();
|
||||||
|
|
|
@ -58,13 +58,16 @@ void RigidBody::Update_LeapFrog( Float updateFrameLength )
|
||||||
Float4x4 wMomentOfInertiaTensor = TransformMatrix( rotationMatrix, this->momentOfInertiaTensor ); // RI
|
Float4x4 wMomentOfInertiaTensor = TransformMatrix( rotationMatrix, this->momentOfInertiaTensor ); // RI
|
||||||
|
|
||||||
// dO = dt * Formula::AngularVelocity( (RI)^-1, avg_H ) = dt * (RI)^-1 * avg_H
|
// dO = dt * Formula::AngularVelocity( (RI)^-1, avg_H ) = dt * (RI)^-1 * avg_H
|
||||||
this->axis += Radian( Formula::AngularVelocity(wMomentOfInertiaTensor.GetInverse(), AverageWithDelta(this->momentum_Angular, this->impulse_Angular)) );
|
|
||||||
this->rotation = Rotation( this->axis );
|
//! HACK: @todo Rotation temporary disabled
|
||||||
|
//this->axis += Radian( Formula::AngularVelocity(wMomentOfInertiaTensor.GetInverse(), AverageWithDelta(this->momentum_Angular, this->impulse_Angular)) );
|
||||||
|
//this->rotation = Rotation( this->axis );
|
||||||
|
|
||||||
// update momentums and clear impulse_Linear and impulse_Angular
|
// update momentums and clear impulse_Linear and impulse_Angular
|
||||||
this->momentum_Linear += this->impulse_Linear;
|
this->momentum_Linear += this->impulse_Linear;
|
||||||
this->impulse_Linear = Float4::null;
|
this->impulse_Linear = Float4::null;
|
||||||
this->momentum_Angular += this->impulse_Angular;
|
|
||||||
|
//this->momentum_Angular += this->impulse_Angular; //! HACK: @todo Rotation temporary disabled
|
||||||
this->impulse_Angular = Float4::null;
|
this->impulse_Angular = Float4::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue