Closed WaneOshin closed 3 months ago
I haven't been able to reproduce the issue. Is this on latest master? If it is, finding a specific ray and configuration where the failure occurs would help me isolate it.
i cant upload code on git! (ill try send it to ur discord if u give me) I used the "Tank" example of the latest master and added some rays and changed the Map (static objects) to the code i provided in my first comment right above ^^^^.
https://github.com/user-attachments/assets/93f87d66-e529-489b-a972-3155e7534ca8
Could you provide the exact configuration of the statics that show the issue, plus a copy-pasted ray origin/direction that shows the issue? (The code provided earlier is helpful, but given my failure to replicate, having exact values may be important.)
I did! I sent the full code to you on discord. did you not receive it?
Thanks for the additional information; I think I know what's happening now. With the given configuration and ray, the IRayHitHandler
will report two locations. One will be the cylinder, and one will be the box:
Cylinder impact: T = 0.81722957, normal = <-8.863883E-08, 0.74355644, 0.66867316>
Box impact: T = 1.8486543, normal = <0, 1, 0>
If the IRayHitHandler
expects that values will always be returned in sorted-by-T order, it may early out after observing the box impact. That would be an error, though, because the IRayHitHandler
does not receive strictly sorted results. Instead, it receives results in traversal order. Results are often vaguely depth-sorted because the traversal visits closer nodes first, but that is based on node AABB intersections and cannot guarantee a true ordering.
Likewise, if the IRayHitHandler
just accepts every result that is reported without terminating early and stores the reported values to a single field, it will tend to terminate with one of the last intersections.
The grabber has an example of an IRayHitHandler
that terminates with the earliest hit:
https://github.com/bepu/bepuphysics2/blob/master/Demos/Grabber.cs#L24
Theres an issue when ray casting a simple ray onto a static cylinder thats on a static big box (used as ground) . . .
When the ray is further away from the cylinder it detects the cylinder. . . But when it gets closer it raycasts to the box and ignores the cylinder. . . However ,When changing the box to be at Y=-1000 , the ray works as intended. . . Code:
is this a BroadPhase detection problem? how to fix it because its a big issue when creating raycast Cars for example. Thank you for the great Physics Engine btw .