Typically if I want to get the closest object in range, I would do a vector subtraction. But sometimes the object could be very close, but they are elevated, and actually take much more distance to get there with navmesh.
For every frame I’m comparing all these vector subtracted distances to decide which object to go to, but obviously the objects that are close but elevated could be extremely misleading.
Are there any built-in functions where it would return the navmesh calculated distance between two targets? And will it be extremely heavy in computations for me to do such comparison to a certain number of object every frame?
Thanks for the link,
Can I ask if this is too much computation per frame? say I have randomly instantiated 50 objects to compare with the agent, I would for example, set destination to one object, calculate the remaining distance, check if that is the lowest distance number, and do that 50 times. How heavy is it for that logic? Is it reasonable?
You’re the only one that can answer this. Profile it and test on your target hardware to see if it is a problem or not. This is entirely relative to your scope, target hardware and computational demands of other parts of the project.