diff options
author | Ricardo Buring <ricardo.buring@gmail.com> | 2023-03-23 15:59:41 +0100 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-27 17:50:35 +0200 |
commit | 58d8368481813398aab77717a59461c3b79e3a2d (patch) | |
tree | c269ccdb11fc61fb79c81b77fc39cf618632dd5c | |
parent | 2a52307936f11aede9c8968f8c02c8e8f9ee29e1 (diff) |
Fix collide_shape return type
Fix PhysicsDirectSpaceState3D::_collide_shape return type.
Also PhysicsDirectSpaceState2D::_collide_shape.
(cherry picked from commit 61429a5f49f2509f631703886b8b3234701a0206)
-rw-r--r-- | doc/classes/PhysicsDirectSpaceState2D.xml | 2 | ||||
-rw-r--r-- | doc/classes/PhysicsDirectSpaceState3D.xml | 2 | ||||
-rw-r--r-- | servers/physics_server_2d.cpp | 8 | ||||
-rw-r--r-- | servers/physics_server_2d.h | 2 | ||||
-rw-r--r-- | servers/physics_server_3d.cpp | 8 | ||||
-rw-r--r-- | servers/physics_server_3d.h | 2 |
6 files changed, 12 insertions, 12 deletions
diff --git a/doc/classes/PhysicsDirectSpaceState2D.xml b/doc/classes/PhysicsDirectSpaceState2D.xml index d4cb073d15..588887d491 100644 --- a/doc/classes/PhysicsDirectSpaceState2D.xml +++ b/doc/classes/PhysicsDirectSpaceState2D.xml @@ -21,7 +21,7 @@ </description> </method> <method name="collide_shape"> - <return type="PackedVector2Array[]" /> + <return type="Vector2[]" /> <param index="0" name="parameters" type="PhysicsShapeQueryParameters2D" /> <param index="1" name="max_results" type="int" default="32" /> <description> diff --git a/doc/classes/PhysicsDirectSpaceState3D.xml b/doc/classes/PhysicsDirectSpaceState3D.xml index f7bc74d9ad..b9f2a12245 100644 --- a/doc/classes/PhysicsDirectSpaceState3D.xml +++ b/doc/classes/PhysicsDirectSpaceState3D.xml @@ -21,7 +21,7 @@ </description> </method> <method name="collide_shape"> - <return type="PackedVector3Array[]" /> + <return type="Vector3[]" /> <param index="0" name="parameters" type="PhysicsShapeQueryParameters3D" /> <param index="1" name="max_results" type="int" default="32" /> <description> diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index f9a8d5f156..4ad83ef327 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -409,17 +409,17 @@ Vector<real_t> PhysicsDirectSpaceState2D::_cast_motion(const Ref<PhysicsShapeQue return ret; } -TypedArray<PackedVector2Array> PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) { - ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array()); +TypedArray<Vector2> PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) { + ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray<Vector2>()); Vector<Vector2> ret; ret.resize(p_max_results * 2); int rc = 0; bool res = collide_shape(p_shape_query->get_parameters(), ret.ptrw(), p_max_results, rc); if (!res) { - return TypedArray<PackedVector2Array>(); + return TypedArray<Vector2>(); } - TypedArray<PackedVector2Array> r; + TypedArray<Vector2> r; r.resize(rc * 2); for (int i = 0; i < rc * 2; i++) { r[i] = ret[i]; diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h index 3e254e610e..56ec94ba9f 100644 --- a/servers/physics_server_2d.h +++ b/servers/physics_server_2d.h @@ -120,7 +120,7 @@ class PhysicsDirectSpaceState2D : public Object { TypedArray<Dictionary> _intersect_point(const Ref<PhysicsPointQueryParameters2D> &p_point_query, int p_max_results = 32); TypedArray<Dictionary> _intersect_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results = 32); Vector<real_t> _cast_motion(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query); - TypedArray<PackedVector2Array> _collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results = 32); + TypedArray<Vector2> _collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results = 32); Dictionary _get_rest_info(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query); protected: diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index c9cf8f99af..9495ce2262 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -429,17 +429,17 @@ Vector<real_t> PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQue return ret; } -TypedArray<PackedVector3Array> PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) { - ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array()); +TypedArray<Vector3> PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) { + ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray<Vector3>()); Vector<Vector3> ret; ret.resize(p_max_results * 2); int rc = 0; bool res = collide_shape(p_shape_query->get_parameters(), ret.ptrw(), p_max_results, rc); if (!res) { - return TypedArray<PackedVector3Array>(); + return TypedArray<Vector3>(); } - TypedArray<PackedVector3Array> r; + TypedArray<Vector3> r; r.resize(rc * 2); for (int i = 0; i < rc * 2; i++) { r[i] = ret[i]; diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h index 2c7ebeea66..0275aee818 100644 --- a/servers/physics_server_3d.h +++ b/servers/physics_server_3d.h @@ -125,7 +125,7 @@ private: TypedArray<Dictionary> _intersect_point(const Ref<PhysicsPointQueryParameters3D> &p_point_query, int p_max_results = 32); TypedArray<Dictionary> _intersect_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32); Vector<real_t> _cast_motion(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query); - TypedArray<PackedVector3Array> _collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32); + TypedArray<Vector3> _collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32); Dictionary _get_rest_info(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query); protected: |