RayCast breakdown

It depends[TM] on many factors, including but not limited to the following:

  • How dense the broadphase is. (I.e, how complex + dense collision geometry is in general)
  • Type/complexity of geometry you’re tracing against. (Simple shapes are fast, triangles are expensive)
  • Amount of info requested by the raycast (physical materials, face indices, UV info etc.)

The most obvious answer is to profile it, and find out how much time it’s actually taking. If you’re spending a significant portion of your time on raycasts, maybe consider an alternative approach.

It smells of a design issue though. I’ve never know any system to really require 10K+ raycasts per-second, if you explain waht you want to achieve, somebody might be able to suggest an alternative approach that isn’t so extreme.

In terms of digging into the engine, I wouldn’t bother. The physics engine sits beneath layers of abstractions and templates that make it difficult to actually follow. Generally speaking however, there is an FImplicitObject defined for each type of geometry (sphere, AABB, Trimesh etc), which has a virtual Raycast function. You can dig into the internals and specifics from there.

1 Like