How do you make a FConvexVolume into a Frustum?

Hi,

I’m looking to make a game that has uses different view ports made out of frustum’s for AI to detect other Actors. I didn’t see any frustum class in UE4, the closest thing I’ve found to that was FConvexVolume. From what I’ve see it allows you to create an object with 6 planes.

Basically I would like to know how to set up the FConvexVolume to create a custom frustum and also how I would be able to rotate, translate, and scale the frustum dynamically.

Any help would be really appreciated.

I ended up just making my own frustum class. Partly because I couldn’t understand FConvexVolume, it was easier to make my own, and the frustum I needed was not really standard.

I realized that I set up my frustum similar to the FConvexVolume, with an array of 6 FPlanes. So if you need any convex object with six sides you can do out the plane math, set the array, and then use FConvexVolume’s optimized box, point, and (I think) plane intersection checks. Unreal uses some super optimized checks where they test four planes at once or something, idk it was too hard for me to understand fully.

Just a thought I had before resolving this question.

The technique they are using is called Loop Unrolling

Because the class can define a mesh with any number of planes, there is a chance that the number of planes could be incredibly high. So essentially the first loop in FConvexVolume::Init() examines four planes at a time, and the rest of the rest of the function is just cleaning up the remaining planes if the total number isn’t a multiple of four.