Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions scene/2d/box2d_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,7 @@ void Box2DArea::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
last_step_xform = get_box2dworld_transform();
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case here is doing a fall through which looks perhaps unintentional?

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();

Expand All @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion scene/2d/box2d_collision_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions scene/2d/box2d_physics_body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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() {
Expand Down