angular collision response fix
Incorrect formula found and corrected
This commit is contained in:
parent
502513d4f8
commit
727b2acb82
|
@ -147,7 +147,9 @@ namespace Oyster
|
|||
inline ::Oyster::Math::Float4 CustomBodyState::GetLinearMomentum( const ::Oyster::Math::Float4 &at ) const
|
||||
{
|
||||
//return this->linearMomentum + ::Oyster::Physics3D::Formula::TangentialLinearMomentum( this->angularMomentum, at - this->centerPos ); // C3083 error?
|
||||
return this->linearMomentum + ::Oyster::Math::Float4( this->angularMomentum.xyz.Cross((at - this->centerPos).xyz), 0.0f );
|
||||
|
||||
::Oyster::Math::Float4 offset = at - this->centerPos;
|
||||
return this->linearMomentum + ( ::Oyster::Math::Float4(this->angularMomentum.xyz.Cross(offset.xyz), 0.0f) /= offset.Dot(offset) );
|
||||
}
|
||||
|
||||
inline const ::Oyster::Math::Float4 & CustomBodyState::GetAngularMomentum() const
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Oyster { namespace Physics3D
|
|||
******************************************************************/
|
||||
inline ::Oyster::Math::Float4 TangentialLinearMomentum( const ::Oyster::Math::Float4 &angularMomentum, const ::Oyster::Math::Float4 &worldOffset )
|
||||
{
|
||||
return ::Oyster::Math::Float4( angularMomentum.xyz.Cross(worldOffset.xyz), 0.0f );
|
||||
return ::Oyster::Math::Float4( angularMomentum.xyz.Cross(worldOffset.xyz), 0.0f ) /= worldOffset.Dot( worldOffset );
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
Loading…
Reference in New Issue