Fixed relative size for sphere colliders

This commit is contained in:
Diren D Bharwani 2022-11-02 16:12:47 +08:00
parent 02c79b4cc4
commit 27526dfd92
2 changed files with 3 additions and 3 deletions

View File

@ -265,7 +265,7 @@ namespace SHADE
{ {
const SHVec3& TF_WORLD_SCALE = transformComponent->GetWorldScale(); const SHVec3& TF_WORLD_SCALE = transformComponent->GetWorldScale();
const float MAX_SCALE = SHMath::Max({ TF_WORLD_SCALE.x, TF_WORLD_SCALE.y, TF_WORLD_SCALE.z }); const float MAX_SCALE = SHMath::Max({ TF_WORLD_SCALE.x, TF_WORLD_SCALE.y, TF_WORLD_SCALE.z });
return sphere->GetRadius() / MAX_SCALE; return (sphere->GetRadius() / MAX_SCALE) * 2.0f;
}, },
[collider](float const& value) { collider->SetBoundingSphere(value); }); [collider](float const& value) { collider->SetBoundingSphere(value); });
} }

View File

@ -212,7 +212,7 @@ namespace SHADE
const SHVec3 TF_WORLD_SCALE = transformComponent->GetWorldScale(); const SHVec3 TF_WORLD_SCALE = transformComponent->GetWorldScale();
const float MAX_SCALE = SHMath::Max({ TF_WORLD_SCALE.x, TF_WORLD_SCALE.y, TF_WORLD_SCALE.z }); const float MAX_SCALE = SHMath::Max({ TF_WORLD_SCALE.x, TF_WORLD_SCALE.y, TF_WORLD_SCALE.z });
worldRadius *= MAX_SCALE; worldRadius *= MAX_SCALE * 0.5f;
} }
if (type == Type::SPHERE) if (type == Type::SPHERE)