Skip to content

Expose RayMeshHit for Pointer events #19883

@vladbat00

Description

@vladbat00

What problem does this solve or what need does it fill?

It would be nice to be able to access RayMeshHit for Pointer<E> events. In cases, where meshes are observed for pointer events, it's impossible to get the triangle data without doing another raycast manually. It would be nice to be able to avoid the double work if Bevy could store and expose RayMeshHit data (when applicable) when Pointer observers are triggered.

What solution would you like?

Maybe we could add another optional field to HitData to contain triangle data of a hit mesh (but it kinda makes sense only for the mesh ray casting backend).

Or we could expose another resource where we'd store only mesh ray cast related data, accessible by a combination of PointerId and Entity.

What alternative(s) have you considered?

Atm, the only accessible workaround there seems to exist is to perform another ray cast on a pointer event (which would be great to be able to avoid).

Additional context

It would help a lot for diegetic UI implementation in bevy_egui.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-PickingPointing at and selecting objects of all sortsC-FeatureA new feature, making something new possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions