How does one get a PhysicsRayQueryParameters3D to collide an Area3D

Godot Version

Godot v4.4

Question

I’m trying to get a raycast to detect an Area3D via PhysicsRayQueryParameters3D (which is not a necessity but seems to serve my ends fine enough), and it works, except I can’t figure out how to get it to detect the thing this script is attached to.

var clickrayparams = PhysicsRayQueryParameters3D.new()
clickrayparams.set_collide_with_bodies(false)
clickrayparams.set_collide_with_areas(true)
clickrayparams.from = get_viewport().get_camera_3d().project_ray_origin(get_viewport().get_mouse_position())
clickrayparams.to = get_viewport().get_camera_3d().project_position(get_viewport().get_mouse_position(),100)# that 100 is max distance, so just make it big and leave it thereafter
var clickrayresults = get_world_3d().direct_space_state.intersect_ray(clickrayparams)
print(clickrayresults)


In this shot it detects ceiling0 and without the clickrayparams.set_collide_with_bodies(false) detects all the walls and floor0 but it never picks up floor0_hinge. What is happen

Yeah so I’d uh
disabled its collision
whoops
don’t do that

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.