How To Detect if object is in Camera View?

Hey! I’m looking for a way to check if certain object is in camera view or not? How can I do this?

I did thought of a workaround where I attached a view spectrum collision shape to the camera and if that shape overlaps something then its in view.

But it has many limitations like, you’ve to create the collision shape as per the camera field of view which won’t be accurate. And distant objects which are out of the shape area won’t get detected even if they are in front of the camera.

So, is there any functionality to detect the rendered objects in blueprint? Or any ideas for a workaround is also appreciated.

Thanks.

This might be what you’re looking for: Was Recently Rendered

up you go :slight_smile:

@Fryderider Thank you so much. It works perfectly.
Is it a cheaper solution to use on multiple objects at the same time?

Aaaand here is a C++ way:

// lastOnScreenTime is a float, isVisible is a bool.

if (lastOnScreenTime != *(GetRootPrimitiveComponent()->SceneProxy->GetPrimitiveSceneInfo()->ComponentLastRenderTimeOnScreen)) { 

	isVisible = true; 
	lastOnScreenTime = *(GetRootPrimitiveComponent()->SceneProxy->GetPrimitiveSceneInfo()->ComponentLastRenderTimeOnScreen);

}
else { isVisible = false; }
1 Like

LIFE SAVER

This link is not available
PLz help me out