@@ -216,7 +216,7 @@ void RapierSpace2D::collision_event_callback(rapier2d::Handle world_handle, cons
216
216
217
217
if (event_info->is_sensor ) {
218
218
if (!instanceId1.is_valid ()) {
219
- ERR_FAIL_COND_MSG (pObject2 , " Should be able to get info about a removed object if the other one is still valid." );
219
+ ERR_FAIL_COND_MSG (pObject1 , " Should be able to get info about a removed object if the other one is still valid." );
220
220
return ;
221
221
}
222
222
if (!instanceId2.is_valid ()) {
@@ -235,52 +235,48 @@ void RapierSpace2D::collision_event_callback(rapier2d::Handle world_handle, cons
235
235
}
236
236
237
237
RapierArea2D *pArea = static_cast <RapierArea2D *>(pObject1);
238
- uint32_t area_shape = shape1;
239
- uint32_t other_shape = shape2;
240
- RID other_rid = rid2;
241
- ObjectID other_instance_id = instanceId2;
242
238
if (type2 == RapierCollisionObject2D::TYPE_AREA) {
243
239
RapierArea2D *pArea2 = static_cast <RapierArea2D *>(pObject2);
244
240
if (event_info->is_started ) {
245
241
ERR_FAIL_COND (!pArea);
246
242
ERR_FAIL_COND (!pArea2);
247
- pArea->on_area_enter (collider_handle2, pArea2, other_shape, other_rid, other_instance_id , collider_handle1, area_shape );
248
- pArea2->on_area_enter (collider_handle1, pArea, area_shape, other_rid, other_instance_id , collider_handle2, other_shape );
243
+ pArea->on_area_enter (collider_handle2, pArea2, shape2, rid2, instanceId2 , collider_handle1, shape1 );
244
+ pArea2->on_area_enter (collider_handle1, pArea, shape1, rid1, instanceId1 , collider_handle2, shape2 );
249
245
} else {
250
246
if (pArea) {
251
- pArea->on_area_exit (collider_handle2, pArea2, other_shape, other_rid, other_instance_id , collider_handle1, area_shape );
247
+ pArea->on_area_exit (collider_handle2, pArea2, shape2, rid2, instanceId2 , collider_handle1, shape1 );
252
248
} else {
253
249
// Try to retrieve area if not destroyed yet
254
250
pArea = space->get_area_from_rid (rid1);
255
251
if (pArea) {
256
252
// Use invalid area case to keep counters consistent for already removed collider
257
- pArea->on_area_exit (collider_handle2, nullptr , other_shape, other_rid, other_instance_id , collider_handle1, area_shape );
253
+ pArea->on_area_exit (collider_handle2, nullptr , shape2, rid2, instanceId2 , collider_handle1, shape1 );
258
254
}
259
255
}
260
256
if (pArea2) {
261
- pArea2->on_area_exit (collider_handle1, pArea, area_shape, other_rid, other_instance_id , collider_handle2, other_shape );
257
+ pArea2->on_area_exit (collider_handle1, pArea, shape1, rid1, instanceId1 , collider_handle2, shape2 );
262
258
} else {
263
259
// Try to retrieve area if not destroyed yet
264
260
pArea2 = space->get_area_from_rid (rid2);
265
261
if (pArea2) {
266
262
// Use invalid area case to keep counters consistent for already removed collider
267
- pArea2->on_area_exit (collider_handle1, nullptr , area_shape, other_rid, other_instance_id , collider_handle2, other_shape );
263
+ pArea2->on_area_exit (collider_handle1, nullptr , shape1, rid1, instanceId1 , collider_handle2, shape2 );
268
264
}
269
265
}
270
266
}
271
267
} else {
272
268
RapierBody2D *pBody = static_cast <RapierBody2D *>(pObject2);
273
269
if (event_info->is_started ) {
274
270
ERR_FAIL_COND (!pArea);
275
- pArea->on_body_enter (collider_handle2, pBody, other_shape, other_rid, other_instance_id , collider_handle1, area_shape );
271
+ pArea->on_body_enter (collider_handle2, pBody, shape2, rid2, instanceId2 , collider_handle1, shape1 );
276
272
} else if (pArea) {
277
- pArea->on_body_exit (collider_handle2, pBody, other_shape, other_rid, other_instance_id , collider_handle1, area_shape );
273
+ pArea->on_body_exit (collider_handle2, pBody, shape2, rid2, instanceId2 , collider_handle1, shape1 );
278
274
} else {
279
275
// Try to retrieve area if not destroyed yet
280
276
pArea = space->get_area_from_rid (rid1);
281
277
if (pArea) {
282
278
// Use invalid body case to keep counters consistent for already removed collider
283
- pArea->on_body_exit (collider_handle2, nullptr , other_shape, other_rid, other_instance_id , collider_handle1, area_shape , false );
279
+ pArea->on_body_exit (collider_handle2, nullptr , shape2, rid2, instanceId2 , collider_handle1, shape1 , false );
284
280
}
285
281
}
286
282
}
0 commit comments