From 9eb5533f0d753d07721644fa84bf738577653726 Mon Sep 17 00:00:00 2001 From: mhwdvs Date: Fri, 26 Aug 2022 16:32:24 +0800 Subject: [PATCH] Fix undefined behavior setting Collider transforms on a CollisionBody --- src/collision/Collider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collision/Collider.cpp b/src/collision/Collider.cpp index c615b27c..06d51c0a 100644 --- a/src/collision/Collider.cpp +++ b/src/collision/Collider.cpp @@ -112,7 +112,7 @@ void Collider::setLocalToBodyTransform(const Transform& transform) { const Transform& bodyTransform = mBody->mWorld.mTransformComponents.getTransform(mBody->getEntity()); mBody->mWorld.mCollidersComponents.setLocalToWorldTransform(mEntity, bodyTransform * transform); - RigidBody* rigidBody = static_cast(mBody); + RigidBody* rigidBody = dynamic_cast(mBody); if (rigidBody != nullptr) { rigidBody->setIsSleeping(false); }