Physics3D/Constraint3D: Add Damping/ImpulseClamp properties

This commit is contained in:
SirLynix 2023-03-23 13:10:07 +01:00 committed by Jérôme Leclercq
parent 3efd422e86
commit 4d42c0cf9c
2 changed files with 26 additions and 0 deletions

View File

@ -64,8 +64,14 @@ namespace Nz
Vector3f GetFirstAnchor() const; Vector3f GetFirstAnchor() const;
Vector3f GetSecondAnchor() const; Vector3f GetSecondAnchor() const;
float GetDamping() const;
float GetImpulseClamp() const;
void SetFirstAnchor(const Vector3f& firstAnchor); void SetFirstAnchor(const Vector3f& firstAnchor);
void SetSecondAnchor(const Vector3f& secondAnchor); void SetSecondAnchor(const Vector3f& secondAnchor);
void SetDamping(float damping);
void SetImpulseClamp(float impulseClamp);
}; };
} }

View File

@ -111,6 +111,16 @@ namespace Nz
return FromBullet(GetConstraint<btPoint2PointConstraint>()->getPivotInB()); return FromBullet(GetConstraint<btPoint2PointConstraint>()->getPivotInB());
} }
float BulletPivotConstraint3D::GetDamping() const
{
return GetConstraint<btPoint2PointConstraint>()->m_setting.m_damping;
}
float BulletPivotConstraint3D::GetImpulseClamp() const
{
return GetConstraint<btPoint2PointConstraint>()->m_setting.m_impulseClamp;
}
void BulletPivotConstraint3D::SetFirstAnchor(const Vector3f& firstAnchor) void BulletPivotConstraint3D::SetFirstAnchor(const Vector3f& firstAnchor)
{ {
GetConstraint<btPoint2PointConstraint>()->setPivotA(ToBullet(firstAnchor)); GetConstraint<btPoint2PointConstraint>()->setPivotA(ToBullet(firstAnchor));
@ -120,4 +130,14 @@ namespace Nz
{ {
GetConstraint<btPoint2PointConstraint>()->setPivotB(ToBullet(secondAnchor)); GetConstraint<btPoint2PointConstraint>()->setPivotB(ToBullet(secondAnchor));
} }
void BulletPivotConstraint3D::SetDamping(float damping)
{
GetConstraint<btPoint2PointConstraint>()->m_setting.m_damping = damping;
}
void BulletPivotConstraint3D::SetImpulseClamp(float impulseClamp)
{
GetConstraint<btPoint2PointConstraint>()->m_setting.m_impulseClamp = impulseClamp;
}
} }