From 79d5b7f2580e5da87d8c962558517d7cc65fdf45 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 26 Apr 2015 17:46:20 -0300 Subject: -fixed bodyenter/bodyexit callback of physics bodies, fixes #1739 --- scene/3d/physics_body.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'scene/3d/physics_body.cpp') diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 469ea0dd9..3d5091f66 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -338,14 +338,14 @@ void RigidBody::_direct_state_changed(Object *p_state) { ObjectID obj = state->get_contact_collider_id(i); int local_shape = state->get_contact_local_shape(i); int shape = state->get_contact_collider_shape(i); - toadd[i].local_shape=local_shape; - toadd[i].id=obj; - toadd[i].shape=shape; - bool found=false; +// bool found=false; Map::Element *E=contact_monitor->body_map.find(obj); if (!E) { + toadd[toadd_count].local_shape=local_shape; + toadd[toadd_count].id=obj; + toadd[toadd_count].shape=shape; toadd_count++; continue; } @@ -354,6 +354,9 @@ void RigidBody::_direct_state_changed(Object *p_state) { int idx = E->get().shapes.find(sp); if (idx==-1) { + toadd[toadd_count].local_shape=local_shape; + toadd[toadd_count].id=obj; + toadd[toadd_count].shape=shape; toadd_count++; continue; } -- cgit v1.2.3-70-g09d2