Distance to the nearest wall

Started by
0 comments, last by frob 7 years, 5 months ago

Hello,

Currently, I am comparing the distance by using a raycast from the object to the static mesh.

which isn't quite correct, since the static mesh can have a hollow body, so the ray won't hit anything,

or get hit at a far distance, the wall at the very far end.

So I try to compare against the bounding boxes of each frame in the hierarchy which will lead to

a performance hit if the hierarchy is very huge.

Is it possible to form a large irregular tight bounding volume of the static geometry.

So that a ray can be casted on it?

Thanks

Jack

Advertisement
Is it possible? Sure. You can design a system that uses a coarse mesh and a fine mesh for testing, often called narrow-phase and broad-phase tests.


Generally the solution is to start with smaller objects and use a spatial tree. After that another solution is to tag items with a specific attribute, which can help if you need to further reduce your search. Combining them, you would have your spatial grid look in concentric rings for objects with the tag.

This topic is closed to new replies.

Advertisement