You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
callback: The callback that will be called for every entity with a table containing data about the intersection.
Fields:
fraction: number : A number ranging from 0 to 1 indicating how far the ray travelled before hitting the entity.
hitPos: vec2 : The hit position.
hitNormal: vec2 : The hit position.
hitEntity: Entity : The hit entity.
Remarks:
There is not particular order in which the callback will be called, if you want to have code executed for every entity a particular order, for example nearest to furthest you have to store all entities in a table and order it by fraction once this function returns and iterate from there.
If you're only interested with the nearest hit, consider using the more efficient physics.Trace function.