Fix csgshape collider without object id
This commit is contained in:
parent
6f9aa8727c
commit
3aeeaa9318
1 changed files with 2 additions and 0 deletions
|
@ -47,6 +47,7 @@ void CSGShape::set_use_collision(bool p_enable) {
|
||||||
PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
||||||
PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
||||||
PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
||||||
|
PhysicsServer::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
|
||||||
_make_dirty(); //force update
|
_make_dirty(); //force update
|
||||||
} else {
|
} else {
|
||||||
PhysicsServer::get_singleton()->free(root_collision_instance);
|
PhysicsServer::get_singleton()->free(root_collision_instance);
|
||||||
|
@ -468,6 +469,7 @@ void CSGShape::_notification(int p_what) {
|
||||||
PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
||||||
PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
||||||
PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
||||||
|
PhysicsServer::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
_make_dirty();
|
_make_dirty();
|
||||||
|
|
Loading…
Reference in a new issue