From 82dac646598fb4799165952460cf8e4479f9fbef Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sat, 29 Oct 2022 19:41:03 +0200 Subject: [PATCH] Change exclude property in `PhysicsRayQueryParameters3D` to TypedArray Change type of exclude property from `Vector` to `TypedArray` which is consistent with the 2D version. --- doc/classes/PhysicsRayQueryParameters3D.xml | 4 ++-- servers/physics_server_3d.cpp | 10 +++++----- servers/physics_server_3d.h | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/classes/PhysicsRayQueryParameters3D.xml b/doc/classes/PhysicsRayQueryParameters3D.xml index 620aa6bf5f34..03d6939e6d2b 100644 --- a/doc/classes/PhysicsRayQueryParameters3D.xml +++ b/doc/classes/PhysicsRayQueryParameters3D.xml @@ -14,7 +14,7 @@ - + Returns a new, pre-configured [PhysicsRayQueryParameters3D] object. Use it to quickly create query parameters using the most common options. [codeblock] @@ -34,7 +34,7 @@ The physics layers the query will detect (as a bitmask). By default, all collision layers are detected. See [url=$DOCS_URL/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information. - + The list of objects or object [RID]s that will be excluded from collisions. diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index db21e1db0632..35833341f226 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -169,19 +169,19 @@ PhysicsDirectBodyState3D::PhysicsDirectBodyState3D() {} /////////////////////////////////////////////////////// -void PhysicsRayQueryParameters3D::set_exclude(const Vector &p_exclude) { +void PhysicsRayQueryParameters3D::set_exclude(const TypedArray &p_exclude) { parameters.exclude.clear(); for (int i = 0; i < p_exclude.size(); i++) { parameters.exclude.insert(p_exclude[i]); } } -Vector PhysicsRayQueryParameters3D::get_exclude() const { - Vector ret; +TypedArray PhysicsRayQueryParameters3D::get_exclude() const { + TypedArray ret; ret.resize(parameters.exclude.size()); int idx = 0; for (const RID &E : parameters.exclude) { - ret.write[idx++] = E; + ret[idx++] = E; } return ret; } @@ -225,7 +225,7 @@ void PhysicsRayQueryParameters3D::_bind_methods() { /////////////////////////////////////////////////////// -Ref PhysicsRayQueryParameters3D::create(Vector3 p_from, Vector3 p_to, uint32_t p_mask, const Vector &p_exclude) { +Ref PhysicsRayQueryParameters3D::create(Vector3 p_from, Vector3 p_to, uint32_t p_mask, const TypedArray &p_exclude) { Ref params; params.instantiate(); params->set_from(p_from); diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h index 87877ad52d32..de6645f27e9a 100644 --- a/servers/physics_server_3d.h +++ b/servers/physics_server_3d.h @@ -822,7 +822,7 @@ class PhysicsRayQueryParameters3D : public RefCounted { static void _bind_methods(); public: - static Ref create(Vector3 p_from, Vector3 p_to, uint32_t p_mask, const Vector &p_exclude); + static Ref create(Vector3 p_from, Vector3 p_to, uint32_t p_mask, const TypedArray &p_exclude); const PhysicsDirectSpaceState3D::RayParameters &get_parameters() const { return parameters; } void set_from(const Vector3 &p_from) { parameters.from = p_from; } @@ -846,8 +846,8 @@ class PhysicsRayQueryParameters3D : public RefCounted { void set_hit_back_faces(bool p_enable) { parameters.hit_back_faces = p_enable; } bool is_hit_back_faces_enabled() const { return parameters.hit_back_faces; } - void set_exclude(const Vector &p_exclude); - Vector get_exclude() const; + void set_exclude(const TypedArray &p_exclude); + TypedArray get_exclude() const; }; class PhysicsPointQueryParameters3D : public RefCounted {