Bounds for custom actor

I have a class derived from AActor that has a USceneComponent at its root and a UInstancedStaticMeshComponent attached to that. The object creates 3 mesh instances in BeginPlay, and it uses a material that applies a World Position Offset to move the meshes in the scene.

How do I manually set the bounds for the entire object such that I don’t have occlusion issues? Right now the instances flicker and disappear depending on if I’m looking at / close enough to the object’s origin.

Hey, me. What you want to do is create a class that inherits from USceneComponent and override its CalcBounds function. You can have it track a FBox, which you can += other FBox’s to, and then just return FBoxSphereBounds(boundsBox.MoveTo(LocalToWorld.GetLocation())) from the CalcBounds function.

1 Like