Describe the bug
When you build the acceleration structure, the entity ids are cached for lookup later (allowing the user to get information on the hit entity), however given the accel struct is not updated constantly, there is a high likelihood that an entity that was valid when building, is now invalid, or points to a completely different entity that just happens to have the same id.
To Reproduce
Steps to reproduce the behaviour:
Spawn a prop
Build accel
Remove prop and spawn another (which will get the id that was just freed)
Hit prop with traversal and print the entity (it'll be the second prop, not the one we hit)
Expected behaviour
Either a generic invalid entity would be given, the id would be given (allowing the user to cache the required entity data when building accel, then index that table with the id), or allow the user to pass a table along with the entity table, which would be indexed when a traversal hits an entity, and the contents at that index passed out through a new HitResult parameter, UserData.
Describe the bug When you build the acceleration structure, the entity ids are cached for lookup later (allowing the user to get information on the hit entity), however given the accel struct is not updated constantly, there is a high likelihood that an entity that was valid when building, is now invalid, or points to a completely different entity that just happens to have the same id.
To Reproduce Steps to reproduce the behaviour:
Expected behaviour Either a generic invalid entity would be given, the id would be given (allowing the user to cache the required entity data when building accel, then index that table with the id), or allow the user to pass a table along with the entity table, which would be indexed when a traversal hits an entity, and the contents at that index passed out through a new
HitResult
parameter,UserData
.