This commit is contained in:
Ruan Lucas
2023-09-07 11:33:16 -04:00
parent 36dca16991
commit fc7c24f771

View File

@@ -245,12 +245,10 @@ void CharacterController::CreateShape()
void CharacterController::UpdateBounds() void CharacterController::UpdateBounds()
{ {
void* actor = _shape ? PhysicsBackend::GetShapeActor(_shape) : nullptr; const float radius = Math::Max(_height, _radius);
if (actor) const Vector3 position = _transform.LocalToWorld(_center);
PhysicsBackend::GetActorBounds(actor, _box); _sphere = BoundingSphere(position, radius);
else _box = BoundingBox::FromSphere(_sphere);
_box = BoundingBox(_transform.Translation);
BoundingSphere::FromBox(_box, _sphere);
} }
void CharacterController::AddMovement(const Vector3& translation, const Quaternion& rotation) void CharacterController::AddMovement(const Vector3& translation, const Quaternion& rotation)