Merge pull request #6030 from aws-lumberyard-dev/ragdoll-collider-alignment
fix alignment of autosized ragdoll colliders
This commit is contained in:
@@ -273,7 +273,7 @@ namespace EMotionFX
|
||||
{
|
||||
AZ::Vector3 boneCenter = nodeTransform.GetTranslation() + 0.5f * boneDirection;
|
||||
float sumDistanceFromAxisSq = 0.0f;
|
||||
float boneLengthSqReciprocal = 1.0f / boneDirection.GetLengthSq();
|
||||
float boneLengthSqReciprocal = 1.0f / (boneLength * boneLength);
|
||||
for (int i = 0; i < numMeshPoints; i++)
|
||||
{
|
||||
meshPoints[i] -= boneCenter;
|
||||
@@ -299,7 +299,7 @@ namespace EMotionFX
|
||||
{
|
||||
Physics::CapsuleShapeConfiguration* capsule = static_cast<Physics::CapsuleShapeConfiguration*>(collider.second.get());
|
||||
capsule->m_height = boneDirection.GetLength();
|
||||
if (AZ::IsClose(localBoneDirection.GetLength(), 1.0f))
|
||||
if (!localBoneDirection.IsZero())
|
||||
{
|
||||
collider.first->m_rotation = AZ::Quaternion::CreateShortestArc(AZ::Vector3::CreateAxisZ(), localBoneDirection.GetNormalized());
|
||||
}
|
||||
@@ -309,7 +309,7 @@ namespace EMotionFX
|
||||
}
|
||||
else if (colliderType == azrtti_typeid<Physics::BoxShapeConfiguration>())
|
||||
{
|
||||
if (AZ::IsClose(localBoneDirection.GetLength(), 1.0f))
|
||||
if (!localBoneDirection.IsZero())
|
||||
{
|
||||
collider.first->m_rotation = AZ::Quaternion::CreateShortestArc(AZ::Vector3::CreateAxisZ(), localBoneDirection.GetNormalized());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user