-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
intersect_ray that returns multiple results #14608
Comments
Maybe you could use intersect_shape with a LineShape, though I'm not sure in which order the hits will be (though they can be sorted easily with array.sort_custom) |
@Zylann a segment shape, not line. And ray must return only one result because that are rays for. |
so Zylann's approach is the legitimate/proper way to do what I want? |
I stepped through the engine code and noticed that the engine does most of the work already for this. So having a method like ray_cast that returns an array of hits I is still very helpful! |
3d shapes? Or just 2d shapes? |
2D shapes, 3D do not have that option. Maybe PhysicsServer/PhysicsDirectSpaceState can add/expose some extra functions using Bullet, I think it is possible to do something similar to |
A dirty solution for now could be a while loop that casts ray, and adds
whathever you find to the exclude list and cast again
…On Dec 26, 2017 7:55 PM, "eon-s" ***@***.***> wrote:
2D shapes, 3D do not have that option.
Maybe PhysicsServer/PhysicsDirectSpaceState can add/expose some extra
functions using Bullet, I think it is possible to do something similar to
collide_and_get_contacts with it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#14608 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z25SdwFahxfDg9STjmSDpaOMTPkXJks5tEXlSgaJpZM4Q_0zY>
.
|
Yea that's what i have been doing to hold me over. |
The dirty solution of using a while loop and adding objects to the exclude list is currently not possible if your ray ever intersects a GridMap due to #27282 |
Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine. The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker. If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance! |
I am using intersect_ray for screen picking. The problem I have is that I don't just want the first object the ray hits, but I want them all, sorted in an array by distance from the start so I can iterate over them and determine which one to pick.
I have to work around this at the moment by doing multiple raycasts and using the exclusion list until nothing more is detected. Obviously this is going to be slower than a singular raycast that would return multiple results.
The text was updated successfully, but these errors were encountered: