diff options
Diffstat (limited to 'scene/3d/collision_object_3d.cpp')
-rw-r--r-- | scene/3d/collision_object_3d.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index 5d050e32b0..9aaa182a13 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -34,11 +34,8 @@ #include "servers/physics_server_3d.h" void CollisionObject3D::_notification(int p_what) { - switch (p_what) { - case NOTIFICATION_ENTER_WORLD: { - if (area) PhysicsServer3D::get_singleton()->area_set_transform(rid, get_global_transform()); else @@ -55,7 +52,6 @@ void CollisionObject3D::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - if (area) PhysicsServer3D::get_singleton()->area_set_transform(rid, get_global_transform()); else @@ -63,12 +59,10 @@ void CollisionObject3D::_notification(int p_what) { } break; case NOTIFICATION_VISIBILITY_CHANGED: { - _update_pickable(); } break; case NOTIFICATION_EXIT_WORLD: { - if (area) { PhysicsServer3D::get_singleton()->area_set_space(rid, RID()); } else @@ -79,7 +73,6 @@ void CollisionObject3D::_notification(int p_what) { } void CollisionObject3D::_input_event(Node *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape) { - if (get_script_instance()) { get_script_instance()->call(SceneStringNames::get_singleton()->_input_event, p_camera, p_input_event, p_pos, p_normal, p_shape); } @@ -87,7 +80,6 @@ void CollisionObject3D::_input_event(Node *p_camera, const Ref<InputEvent> &p_in } void CollisionObject3D::_mouse_enter() { - if (get_script_instance()) { get_script_instance()->call(SceneStringNames::get_singleton()->_mouse_enter); } @@ -95,7 +87,6 @@ void CollisionObject3D::_mouse_enter() { } void CollisionObject3D::_mouse_exit() { - if (get_script_instance()) { get_script_instance()->call(SceneStringNames::get_singleton()->_mouse_exit); } @@ -114,18 +105,15 @@ void CollisionObject3D::_update_pickable() { } void CollisionObject3D::set_ray_pickable(bool p_ray_pickable) { - ray_pickable = p_ray_pickable; _update_pickable(); } bool CollisionObject3D::is_ray_pickable() const { - return ray_pickable; } void CollisionObject3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_ray_pickable", "ray_pickable"), &CollisionObject3D::set_ray_pickable); ClassDB::bind_method(D_METHOD("is_ray_pickable"), &CollisionObject3D::is_ray_pickable); ClassDB::bind_method(D_METHOD("set_capture_input_on_drag", "enable"), &CollisionObject3D::set_capture_input_on_drag); @@ -158,7 +146,6 @@ void CollisionObject3D::_bind_methods() { } uint32_t CollisionObject3D::create_shape_owner(Object *p_owner) { - ShapeData sd; uint32_t id; @@ -176,7 +163,6 @@ uint32_t CollisionObject3D::create_shape_owner(Object *p_owner) { } void CollisionObject3D::remove_shape_owner(uint32_t owner) { - ERR_FAIL_COND(!shapes.has(owner)); shape_owner_clear_shapes(owner); @@ -199,21 +185,18 @@ void CollisionObject3D::shape_owner_set_disabled(uint32_t p_owner, bool p_disabl } bool CollisionObject3D::is_shape_owner_disabled(uint32_t p_owner) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), false); return shapes[p_owner].disabled; } void CollisionObject3D::get_shape_owners(List<uint32_t> *r_owners) { - for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) { r_owners->push_back(E->key()); } } Array CollisionObject3D::_get_shape_owners() { - Array ret; for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) { ret.push_back(E->key()); @@ -223,7 +206,6 @@ Array CollisionObject3D::_get_shape_owners() { } void CollisionObject3D::shape_owner_set_transform(uint32_t p_owner, const Transform &p_transform) { - ERR_FAIL_COND(!shapes.has(p_owner)); ShapeData &sd = shapes[p_owner]; @@ -237,21 +219,18 @@ void CollisionObject3D::shape_owner_set_transform(uint32_t p_owner, const Transf } } Transform CollisionObject3D::shape_owner_get_transform(uint32_t p_owner) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), Transform()); return shapes[p_owner].xform; } Object *CollisionObject3D::shape_owner_get_owner(uint32_t p_owner) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), nullptr); return shapes[p_owner].owner; } void CollisionObject3D::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape3D> &p_shape) { - ERR_FAIL_COND(!shapes.has(p_owner)); ERR_FAIL_COND(p_shape.is_null()); @@ -269,20 +248,17 @@ void CollisionObject3D::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape3 total_subshapes++; } int CollisionObject3D::shape_owner_get_shape_count(uint32_t p_owner) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), 0); return shapes[p_owner].shapes.size(); } Ref<Shape3D> CollisionObject3D::shape_owner_get_shape(uint32_t p_owner, int p_shape) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), Ref<Shape3D>()); ERR_FAIL_INDEX_V(p_shape, shapes[p_owner].shapes.size(), Ref<Shape3D>()); return shapes[p_owner].shapes[p_shape].shape; } int CollisionObject3D::shape_owner_get_shape_index(uint32_t p_owner, int p_shape) const { - ERR_FAIL_COND_V(!shapes.has(p_owner), -1); ERR_FAIL_INDEX_V(p_shape, shapes[p_owner].shapes.size(), -1); @@ -290,7 +266,6 @@ int CollisionObject3D::shape_owner_get_shape_index(uint32_t p_owner, int p_shape } void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape) { - ERR_FAIL_COND(!shapes.has(p_owner)); ERR_FAIL_INDEX(p_shape, shapes[p_owner].shapes.size()); @@ -315,7 +290,6 @@ void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape) } void CollisionObject3D::shape_owner_clear_shapes(uint32_t p_owner) { - ERR_FAIL_COND(!shapes.has(p_owner)); while (shape_owner_get_shape_count(p_owner) > 0) { @@ -324,7 +298,6 @@ void CollisionObject3D::shape_owner_clear_shapes(uint32_t p_owner) { } uint32_t CollisionObject3D::shape_find_owner(int p_shape_index) const { - ERR_FAIL_INDEX_V(p_shape_index, total_subshapes, 0); for (const Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) { @@ -340,7 +313,6 @@ uint32_t CollisionObject3D::shape_find_owner(int p_shape_index) const { } CollisionObject3D::CollisionObject3D(RID p_rid, bool p_area) { - rid = p_rid; area = p_area; capture_input_on_drag = false; @@ -357,17 +329,14 @@ CollisionObject3D::CollisionObject3D(RID p_rid, bool p_area) { } void CollisionObject3D::set_capture_input_on_drag(bool p_capture) { - capture_input_on_drag = p_capture; } bool CollisionObject3D::get_capture_input_on_drag() const { - return capture_input_on_drag; } String CollisionObject3D::get_configuration_warning() const { - String warning = Node3D::get_configuration_warning(); if (shapes.empty()) { @@ -381,7 +350,6 @@ String CollisionObject3D::get_configuration_warning() const { } CollisionObject3D::CollisionObject3D() { - capture_input_on_drag = false; ray_pickable = true; set_notify_transform(true); @@ -391,6 +359,5 @@ CollisionObject3D::CollisionObject3D() { } CollisionObject3D::~CollisionObject3D() { - PhysicsServer3D::get_singleton()->free(rid); } |