From 4d42c0cf9c94ec0ac67f86d5819deda9fb14b247 Mon Sep 17 00:00:00 2001 From: SirLynix Date: Thu, 23 Mar 2023 13:10:07 +0100 Subject: [PATCH] Physics3D/Constraint3D: Add Damping/ImpulseClamp properties --- .../BulletPhysics3D/BulletConstraint3D.hpp | 6 ++++++ .../BulletPhysics3D/BulletConstraint3D.cpp | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/Nazara/BulletPhysics3D/BulletConstraint3D.hpp b/include/Nazara/BulletPhysics3D/BulletConstraint3D.hpp index 40e61a8c7..bcf3ba44d 100644 --- a/include/Nazara/BulletPhysics3D/BulletConstraint3D.hpp +++ b/include/Nazara/BulletPhysics3D/BulletConstraint3D.hpp @@ -64,8 +64,14 @@ namespace Nz Vector3f GetFirstAnchor() const; Vector3f GetSecondAnchor() const; + float GetDamping() const; + float GetImpulseClamp() const; + void SetFirstAnchor(const Vector3f& firstAnchor); void SetSecondAnchor(const Vector3f& secondAnchor); + + void SetDamping(float damping); + void SetImpulseClamp(float impulseClamp); }; } diff --git a/src/Nazara/BulletPhysics3D/BulletConstraint3D.cpp b/src/Nazara/BulletPhysics3D/BulletConstraint3D.cpp index 0126108de..ec68bfa36 100644 --- a/src/Nazara/BulletPhysics3D/BulletConstraint3D.cpp +++ b/src/Nazara/BulletPhysics3D/BulletConstraint3D.cpp @@ -111,6 +111,16 @@ namespace Nz return FromBullet(GetConstraint()->getPivotInB()); } + float BulletPivotConstraint3D::GetDamping() const + { + return GetConstraint()->m_setting.m_damping; + } + + float BulletPivotConstraint3D::GetImpulseClamp() const + { + return GetConstraint()->m_setting.m_impulseClamp; + } + void BulletPivotConstraint3D::SetFirstAnchor(const Vector3f& firstAnchor) { GetConstraint()->setPivotA(ToBullet(firstAnchor)); @@ -120,4 +130,14 @@ namespace Nz { GetConstraint()->setPivotB(ToBullet(secondAnchor)); } + + void BulletPivotConstraint3D::SetDamping(float damping) + { + GetConstraint()->m_setting.m_damping = damping; + } + + void BulletPivotConstraint3D::SetImpulseClamp(float impulseClamp) + { + GetConstraint()->m_setting.m_impulseClamp = impulseClamp; + } }