reactphysics3d icon indicating copy to clipboard operation
reactphysics3d copied to clipboard

Raycasting needs more information in the eventhandler

Open joleary opened this issue 6 months ago • 0 comments

Either I am missing something or there is no real way to identify a distinct ray when using the notifyRaycastHit method of the eventhandler. This makes it hard to apply the correct handling when using rays to drive gameplay.

You can set flags to mask the hit colliders, and have a seperate eventhandler instance for each ray type which seems wasteful. You would need to provide a mask and event handler for each ray type.

Is it possible to add a userData field to Ray that gets propagated to the raycastinfo, so you can determine which ray hit which colliders? Or failing that, the bitmask used in the query so a single handler can know the type of ray sent.

joleary avatar May 29 '25 16:05 joleary