diff options
Diffstat (limited to 'servers/physics_2d')
-rw-r--r-- | servers/physics_2d/body_direct_state_2d_sw.cpp | 16 | ||||
-rw-r--r-- | servers/physics_2d/body_direct_state_2d_sw.h | 1 | ||||
-rw-r--r-- | servers/physics_2d/collision_object_2d_sw.cpp | 5 | ||||
-rw-r--r-- | servers/physics_2d/collision_object_2d_sw.h | 6 | ||||
-rw-r--r-- | servers/physics_2d/physics_server_2d_sw.cpp | 12 | ||||
-rw-r--r-- | servers/physics_2d/physics_server_2d_sw.h | 2 | ||||
-rw-r--r-- | servers/physics_2d/physics_server_2d_wrap_mt.h | 2 | ||||
-rw-r--r-- | servers/physics_2d/space_2d_sw.cpp | 5 |
8 files changed, 0 insertions, 49 deletions
diff --git a/servers/physics_2d/body_direct_state_2d_sw.cpp b/servers/physics_2d/body_direct_state_2d_sw.cpp index 22a5fc2b36..1c6adfe27c 100644 --- a/servers/physics_2d/body_direct_state_2d_sw.cpp +++ b/servers/physics_2d/body_direct_state_2d_sw.cpp @@ -169,22 +169,6 @@ Vector2 PhysicsDirectBodyState2DSW::get_contact_collider_velocity_at_position(in return body->contacts[p_contact_idx].collider_velocity_at_pos; } -Variant PhysicsDirectBodyState2DSW::get_contact_collider_shape_metadata(int p_contact_idx) const { - ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Variant()); - - if (!PhysicsServer2DSW::singletonsw->body_owner.owns(body->contacts[p_contact_idx].collider)) { - return Variant(); - } - Body2DSW *other = PhysicsServer2DSW::singletonsw->body_owner.get_or_null(body->contacts[p_contact_idx].collider); - - int sidx = body->contacts[p_contact_idx].collider_shape; - if (sidx < 0 || sidx >= other->get_shape_count()) { - return Variant(); - } - - return other->get_shape_metadata(sidx); -} - PhysicsDirectSpaceState2D *PhysicsDirectBodyState2DSW::get_space_state() { return body->get_space()->get_direct_state(); } diff --git a/servers/physics_2d/body_direct_state_2d_sw.h b/servers/physics_2d/body_direct_state_2d_sw.h index 34faa174d8..4266b24842 100644 --- a/servers/physics_2d/body_direct_state_2d_sw.h +++ b/servers/physics_2d/body_direct_state_2d_sw.h @@ -80,7 +80,6 @@ public: virtual Vector2 get_contact_collider_position(int p_contact_idx) const override; virtual ObjectID get_contact_collider_id(int p_contact_idx) const override; virtual int get_contact_collider_shape(int p_contact_idx) const override; - virtual Variant get_contact_collider_shape_metadata(int p_contact_idx) const override; virtual Vector2 get_contact_collider_velocity_at_position(int p_contact_idx) const override; diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp index c92f01d120..bc7d277152 100644 --- a/servers/physics_2d/collision_object_2d_sw.cpp +++ b/servers/physics_2d/collision_object_2d_sw.cpp @@ -61,11 +61,6 @@ void CollisionObject2DSW::set_shape(int p_index, Shape2DSW *p_shape) { } } -void CollisionObject2DSW::set_shape_metadata(int p_index, const Variant &p_metadata) { - ERR_FAIL_INDEX(p_index, shapes.size()); - shapes.write[p_index].metadata = p_metadata; -} - void CollisionObject2DSW::set_shape_transform(int p_index, const Transform2D &p_transform) { ERR_FAIL_INDEX(p_index, shapes.size()); diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h index 69487631a6..ca258a906a 100644 --- a/servers/physics_2d/collision_object_2d_sw.h +++ b/servers/physics_2d/collision_object_2d_sw.h @@ -58,7 +58,6 @@ private: BroadPhase2DSW::ID bpid = 0; Rect2 aabb_cache; //for rayqueries Shape2DSW *shape = nullptr; - Variant metadata; bool disabled = false; bool one_way_collision = false; real_t one_way_collision_margin = 0.0; @@ -110,7 +109,6 @@ public: void add_shape(Shape2DSW *p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false); void set_shape(int p_index, Shape2DSW *p_shape); void set_shape_transform(int p_index, const Transform2D &p_transform); - void set_shape_metadata(int p_index, const Variant &p_metadata); _FORCE_INLINE_ int get_shape_count() const { return shapes.size(); } _FORCE_INLINE_ Shape2DSW *get_shape(int p_index) const { @@ -129,10 +127,6 @@ public: CRASH_BAD_INDEX(p_index, shapes.size()); return shapes[p_index].aabb_cache; } - _FORCE_INLINE_ const Variant &get_shape_metadata(int p_index) const { - CRASH_BAD_INDEX(p_index, shapes.size()); - return shapes[p_index].metadata; - } _FORCE_INLINE_ const Transform2D &get_transform() const { return transform; } _FORCE_INLINE_ const Transform2D &get_inv_transform() const { return inv_transform; } diff --git a/servers/physics_2d/physics_server_2d_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp index b4338217df..4315b55df4 100644 --- a/servers/physics_2d/physics_server_2d_sw.cpp +++ b/servers/physics_2d/physics_server_2d_sw.cpp @@ -606,18 +606,6 @@ void PhysicsServer2DSW::body_set_shape_transform(RID p_body, int p_shape_idx, co body->set_shape_transform(p_shape_idx, p_transform); } -void PhysicsServer2DSW::body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant &p_metadata) { - Body2DSW *body = body_owner.get_or_null(p_body); - ERR_FAIL_COND(!body); - body->set_shape_metadata(p_shape_idx, p_metadata); -} - -Variant PhysicsServer2DSW::body_get_shape_metadata(RID p_body, int p_shape_idx) const { - Body2DSW *body = body_owner.get_or_null(p_body); - ERR_FAIL_COND_V(!body, Variant()); - return body->get_shape_metadata(p_shape_idx); -} - int PhysicsServer2DSW::body_get_shape_count(RID p_body) const { Body2DSW *body = body_owner.get_or_null(p_body); ERR_FAIL_COND_V(!body, -1); diff --git a/servers/physics_2d/physics_server_2d_sw.h b/servers/physics_2d/physics_server_2d_sw.h index 1db4dd8343..1f35e83995 100644 --- a/servers/physics_2d/physics_server_2d_sw.h +++ b/servers/physics_2d/physics_server_2d_sw.h @@ -177,12 +177,10 @@ public: virtual void body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform = Transform2D(), bool p_disabled = false) override; virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape) override; virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D &p_transform) override; - virtual void body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant &p_metadata) override; virtual int body_get_shape_count(RID p_body) const override; virtual RID body_get_shape(RID p_body, int p_shape_idx) const override; virtual Transform2D body_get_shape_transform(RID p_body, int p_shape_idx) const override; - virtual Variant body_get_shape_metadata(RID p_body, int p_shape_idx) const override; virtual void body_remove_shape(RID p_body, int p_shape_idx) override; virtual void body_clear_shapes(RID p_body) override; diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.h b/servers/physics_2d/physics_server_2d_wrap_mt.h index f8733863aa..7925344d76 100644 --- a/servers/physics_2d/physics_server_2d_wrap_mt.h +++ b/servers/physics_2d/physics_server_2d_wrap_mt.h @@ -184,11 +184,9 @@ public: FUNC4(body_add_shape, RID, RID, const Transform2D &, bool); FUNC3(body_set_shape, RID, int, RID); FUNC3(body_set_shape_transform, RID, int, const Transform2D &); - FUNC3(body_set_shape_metadata, RID, int, const Variant &); FUNC1RC(int, body_get_shape_count, RID); FUNC2RC(Transform2D, body_get_shape_transform, RID, int); - FUNC2RC(Variant, body_get_shape_metadata, RID, int); FUNC2RC(RID, body_get_shape, RID, int); FUNC3(body_set_shape_disabled, RID, int, bool); diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index df37b11c1b..5cd9bf3223 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -105,7 +105,6 @@ int PhysicsDirectSpaceState2DSW::_intersect_point_impl(const Vector2 &p_point, S } r_results[cc].rid = col_obj->get_self(); r_results[cc].shape = shape_idx; - r_results[cc].metadata = col_obj->get_shape_metadata(shape_idx); cc++; } @@ -193,7 +192,6 @@ bool PhysicsDirectSpaceState2DSW::intersect_ray(const Vector2 &p_from, const Vec r_result.collider = ObjectDB::get_instance(r_result.collider_id); } r_result.normal = res_normal; - r_result.metadata = res_obj->get_shape_metadata(res_shape); r_result.position = res_point; r_result.rid = res_obj->get_self(); r_result.shape = res_shape; @@ -242,7 +240,6 @@ int PhysicsDirectSpaceState2DSW::intersect_shape(const RID &p_shape, const Trans } r_results[cc].rid = col_obj->get_self(); r_results[cc].shape = shape_idx; - r_results[cc].metadata = col_obj->get_shape_metadata(shape_idx); cc++; } @@ -484,7 +481,6 @@ bool PhysicsDirectSpaceState2DSW::rest_info(RID p_shape, const Transform2D &p_sh r_info->normal = rcd.best_normal; r_info->point = rcd.best_contact; r_info->rid = rcd.best_object->get_self(); - r_info->metadata = rcd.best_object->get_shape_metadata(rcd.best_shape); if (rcd.best_object->get_type() == CollisionObject2DSW::TYPE_BODY) { const Body2DSW *body = static_cast<const Body2DSW *>(rcd.best_object); Vector2 rel_vec = r_info->point - (body->get_transform().get_origin() + body->get_center_of_mass()); @@ -961,7 +957,6 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co r_result->collision_depth = rcd.best_len; r_result->collision_safe_fraction = safe; r_result->collision_unsafe_fraction = unsafe; - r_result->collider_metadata = rcd.best_object->get_shape_metadata(rcd.best_shape); const Body2DSW *body = static_cast<const Body2DSW *>(rcd.best_object); Vector2 rel_vec = r_result->collision_point - (body->get_transform().get_origin() + body->get_center_of_mass()); |