From c4742ee7f84e65b890a055b44484fa90cdaa7bc9 Mon Sep 17 00:00:00 2001 From: Jason Knight Date: Tue, 18 Oct 2022 16:01:36 -0600 Subject: [PATCH] Use set_notify_transform() instead of set_notify_local_transform(). --- scene/2d/box2d_area.cpp | 13 ++++++------- scene/2d/box2d_collision_object.cpp | 2 +- scene/2d/box2d_physics_body.cpp | 3 +-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/scene/2d/box2d_area.cpp b/scene/2d/box2d_area.cpp index 5ca25de..2a567ea 100644 --- a/scene/2d/box2d_area.cpp +++ b/scene/2d/box2d_area.cpp @@ -87,13 +87,7 @@ void Box2DArea::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { last_step_xform = get_box2dworld_transform(); } - - case Box2DWorld::NOTIFICATION_WORLD_STEPPED: { - // Don't sync physics position - // This allows areas to move with the scene transform under other physics objects - } break; - - case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { + case NOTIFICATION_TRANSFORM_CHANGED: { // Send new transform to physics Transform2D new_xform = get_box2dworld_transform(); @@ -107,6 +101,11 @@ void Box2DArea::_notification(int p_what) { last_step_xform = new_xform; } break; + + case Box2DWorld::NOTIFICATION_WORLD_STEPPED: { + // Don't sync physics position + // This allows areas to move with the scene transform under other physics objects + } break; } } diff --git a/scene/2d/box2d_collision_object.cpp b/scene/2d/box2d_collision_object.cpp index dbd06b0..c1e8756 100644 --- a/scene/2d/box2d_collision_object.cpp +++ b/scene/2d/box2d_collision_object.cpp @@ -318,7 +318,7 @@ Box2DCollisionObject::Box2DCollisionObject() { filterDef.maskBits = 0x0001; set_physics_process_internal(true); - set_notify_local_transform(true); + set_notify_transform(true); } Box2DCollisionObject::~Box2DCollisionObject() { diff --git a/scene/2d/box2d_physics_body.cpp b/scene/2d/box2d_physics_body.cpp index cc42ce4..b45c624 100644 --- a/scene/2d/box2d_physics_body.cpp +++ b/scene/2d/box2d_physics_body.cpp @@ -344,7 +344,7 @@ void Box2DPhysicsBody::_notification(int p_what) { set_process_internal(false); } break; - case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { + case NOTIFICATION_TRANSFORM_CHANGED: { Mode type = get_type(); Transform2D new_xform = get_box2dworld_transform(); @@ -1165,7 +1165,6 @@ bool Box2DPhysicsBody::is_sync_to_physics_enabled() const { Box2DPhysicsBody::Box2DPhysicsBody() { set_physics_process_internal(true); - set_notify_local_transform(true); } Box2DPhysicsBody::~Box2DPhysicsBody() {