Physics joints updated to the new API (#1361)
Co-authored-by: Ulugbek Adilbekov <ulugbek@amazon.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user