summaryrefslogtreecommitdiff
path: root/scene/main/viewport.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-05 21:52:39 +0100
committerGitHub <noreply@github.com>2021-11-05 21:52:39 +0100
commit13aaa7312427e98661dba0183cbbee6bbc8f6542 (patch)
tree5431544904e0ced5217295f750ecabd0d24ea950 /scene/main/viewport.cpp
parentc7fefe50daebe2f3ae568baaa888ddb3cddfe5e1 (diff)
parentacbd24ea842cb90ab49cd66d5dc7220e57c73f29 (diff)
Merge pull request #54573 from nekomatata/query-parameters
Diffstat (limited to 'scene/main/viewport.cpp')
-rw-r--r--scene/main/viewport.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index cdf1f495e4..31e8c20991 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -638,7 +638,13 @@ void Viewport::_process_picking() {
Vector2 point = canvas_transform.affine_inverse().xform(pos);
- int rc = ss2d->intersect_point_on_canvas(point, canvas_layer_id, res, 64, Set<RID>(), 0xFFFFFFFF, true, true, true);
+ PhysicsDirectSpaceState2D::PointParameters point_params;
+ point_params.position = point;
+ point_params.canvas_instance_id = canvas_layer_id;
+ point_params.collide_with_areas = true;
+ point_params.pick_point = true;
+
+ int rc = ss2d->intersect_point(point_params, res, 64);
for (int i = 0; i < rc; i++) {
if (res[i].collider_id.is_valid() && res[i].collider) {
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(res[i].collider);
@@ -719,7 +725,13 @@ void Viewport::_process_picking() {
PhysicsDirectSpaceState3D *space = PhysicsServer3D::get_singleton()->space_get_direct_state(find_world_3d()->get_space());
if (space) {
- bool col = space->intersect_ray(from, from + dir * far, result, Set<RID>(), 0xFFFFFFFF, true, true, true);
+ PhysicsDirectSpaceState3D::RayParameters ray_params;
+ ray_params.from = from;
+ ray_params.to = from + dir * far;
+ ray_params.collide_with_areas = true;
+ ray_params.pick_ray = true;
+
+ bool col = space->intersect_ray(ray_params, result);
ObjectID new_collider;
if (col) {
CollisionObject3D *co = Object::cast_to<CollisionObject3D>(result.collider);