Download

Trace (Raycast) pathing

So this week I’ve been spending time learning what I can about the trace functions, and kinda hit a bit of a wall. Sure, I’m a total noob, but figured to ask here anyway.

Looks like there’s a way to cast a sphere to check for collisions, line cast as well, but how does the test run? As in, from start point to end point, it’s casting a zero size ray to check for collisions. Think that would make sense for a line trace, but what about a sphere cast? Would that only check for a sphere at the end point? Or check along the path between start and end for the entire sphere size? Or would I have to set up some sort of multiple line tracing starting from the outer boundaries of my character’s collision capsule? Say my landscape has headroom issues, or openings which are wide enough for a trace but smaller than a character/creature/AI. Course maybe I’m barking up the wrong tree here entirely…and the trace functions really aren’t what I should be looking into…

Also, is the tracing dependent on a navmesh? Say I decided for some silly reason to create my own pathing system, because I’m into pain and anguish for some reason, and run the whole thing off a bunch of trace and moveto functions.

Mildly tempted to ask about tracing along an uneven landscape, hills and such, but not looked into this yet and maybe it’s easy in UE.

The “geometry cast” methods use what’s called a sweep test which does indeed ensure that the shape is unimpeded along its entire trajectory, so you don’t need to worry about that. Also, those methods don’t involve the navigation mesh as far as I’m aware - they only refer to the PhysX scene representation.

Keeping in mind that nothing you’ve written really suggests to me any good reason not to just use the Recast nav mesh implementation; there are Recast parameters you can tweak for the agent height and radius, as well as maximum slope and step height.

Ok, good, I’ll keep diving into the source and testing the geometry cast methods.

For the most part, the included nav mesh systems may indeed be plenty with a bit of AI tricks to make things appear more random than they are. Early on this project we were looking into other methods like vector fields and RRT pathfinding. In the end, as long as we can create the illusion of free will, all is good. Still, be nice to know the limitations (if any) of the built in casting methods.

Thanks!