Physics joints updated to the new API (#1361)

Co-authored-by: Ulugbek Adilbekov <ulugbek@amazon.com>
This commit is contained in:
amzn-sean
2021-06-17 15:52:27 +01:00
committed by GitHub
parent c46a17f3a6
commit 9f62d631fb
90 changed files with 2792 additions and 1665 deletions
@@ -38,11 +38,17 @@ namespace PhysX
RagdollNode::~RagdollNode()
{
DestroyJoint();
DestroyPhysicsBody();
}
void RagdollNode::SetJoint(const AZStd::shared_ptr<Physics::Joint>& joint)
void RagdollNode::SetJoint(AzPhysics::Joint* joint)
{
if (m_joint)
{
return;
}
m_joint = joint;
}
@@ -52,7 +58,7 @@ namespace PhysX
return *m_rigidBody;
}
const AZStd::shared_ptr<Physics::Joint>& RagdollNode::GetJoint() const
AzPhysics::Joint* RagdollNode::GetJoint()
{
return m_joint;
}
@@ -167,4 +173,16 @@ namespace PhysX
}
}
void RagdollNode::DestroyJoint()
{
if (m_joint != nullptr && m_sceneOwner != AzPhysics::InvalidSceneHandle)
{
if (auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get())
{
sceneInterface->RemoveJoint(m_sceneOwner, m_joint->m_jointHandle);
}
m_joint = nullptr;
}
}
} // namespace PhysX