Fixed various Physics bugs #217
|
@ -113,11 +113,11 @@ namespace SHADE
|
|||
return flags & (1U << FLAG_POS);
|
||||
}
|
||||
|
||||
bool SHRigidBodyComponent::GetAutoMass() const noexcept
|
||||
{
|
||||
static constexpr int FLAG_POS = 9;
|
||||
return flags & (1U << FLAG_POS);
|
||||
}
|
||||
//bool SHRigidBodyComponent::GetAutoMass() const noexcept
|
||||
//{
|
||||
// static constexpr int FLAG_POS = 9;
|
||||
// return flags & (1U << FLAG_POS);
|
||||
//}
|
||||
|
||||
float SHRigidBodyComponent::GetMass() const noexcept
|
||||
{
|
||||
|
@ -314,14 +314,13 @@ namespace SHADE
|
|||
allowInterpolation ? flags |= 1U << FLAG_POS : flags &= ~(1U << FLAG_POS);
|
||||
}
|
||||
|
||||
void SHRigidBodyComponent::SetAutoMass(bool autoMass) noexcept
|
||||
{
|
||||
static constexpr int FLAG_POS = 9;
|
||||
autoMass ? flags |= 1U << FLAG_POS : flags &= ~(1U << FLAG_POS);
|
||||
|
||||
dirtyFlags |= 1U << FLAG_POS;
|
||||
}
|
||||
//void SHRigidBodyComponent::SetAutoMass(bool autoMass) noexcept
|
||||
//{
|
||||
// static constexpr int FLAG_POS = 9;
|
||||
// autoMass ? flags |= 1U << FLAG_POS : flags &= ~(1U << FLAG_POS);
|
||||
|
||||
// dirtyFlags |= 1U << FLAG_POS;
|
||||
//}
|
||||
|
||||
void SHRigidBodyComponent::SetMass(float newMass) noexcept
|
||||
{
|
||||
|
@ -496,7 +495,7 @@ RTTR_REGISTRATION
|
|||
.property("Use Gravity" , &SHRigidBodyComponent::IsGravityEnabled , &SHRigidBodyComponent::SetGravityEnabled )
|
||||
.property("Interpolate" , &SHRigidBodyComponent::IsInterpolating , &SHRigidBodyComponent::SetInterpolate )
|
||||
.property("Sleeping Enabled" , &SHRigidBodyComponent::IsAllowedToSleep , &SHRigidBodyComponent::SetIsAllowedToSleep)
|
||||
.property("Auto Mass" , &SHRigidBodyComponent::GetAutoMass , &SHRigidBodyComponent::SetAutoMass )
|
||||
//.property("Auto Mass" , &SHRigidBodyComponent::GetAutoMass , &SHRigidBodyComponent::SetAutoMass )
|
||||
.property("Freeze Position X" , &SHRigidBodyComponent::GetFreezePositionX , &SHRigidBodyComponent::SetFreezePositionX )
|
||||
.property("Freeze Position Y" , &SHRigidBodyComponent::GetFreezePositionY , &SHRigidBodyComponent::SetFreezePositionY )
|
||||
.property("Freeze Position Z" , &SHRigidBodyComponent::GetFreezePositionZ , &SHRigidBodyComponent::SetFreezePositionZ )
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace SHADE
|
|||
[[nodiscard]] bool GetFreezeRotationY () const noexcept;
|
||||
[[nodiscard]] bool GetFreezeRotationZ () const noexcept;
|
||||
|
||||
[[nodiscard]] bool GetAutoMass () const noexcept;
|
||||
//[[nodiscard]] bool GetAutoMass () const noexcept;
|
||||
|
||||
[[nodiscard]] float GetMass () const noexcept;
|
||||
[[nodiscard]] float GetDrag () const noexcept;
|
||||
|
@ -112,7 +112,7 @@ namespace SHADE
|
|||
void SetFreezeRotationY (bool freezeRotationY) noexcept;
|
||||
void SetFreezeRotationZ (bool freezeRotationZ) noexcept;
|
||||
void SetInterpolate (bool allowInterpolation) noexcept;
|
||||
void SetAutoMass (bool autoMass) noexcept;
|
||||
//void SetAutoMass (bool autoMass) noexcept;
|
||||
|
||||
void SetMass (float newMass) noexcept;
|
||||
void SetDrag (float newDrag) noexcept;
|
||||
|
|
|
@ -254,17 +254,17 @@ namespace SHADE
|
|||
}
|
||||
case 9: // Mass
|
||||
{
|
||||
if (component.GetAutoMass())
|
||||
{
|
||||
rp3dBody->updateMassPropertiesFromColliders();
|
||||
component.mass = rp3dBody->getMass();
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (component.GetAutoMass())
|
||||
//{
|
||||
// rp3dBody->updateMassPropertiesFromColliders();
|
||||
// component.mass = rp3dBody->getMass();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
rp3dBody->setMass(component.mass);
|
||||
rp3dBody->updateLocalCenterOfMassFromColliders();
|
||||
rp3dBody->updateLocalInertiaTensorFromColliders();
|
||||
}
|
||||
//}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue