VisibleOnScreenNotifier3D with multiple cameras

Godot Version

v4.5.stable.official

Question

I have multiple cameras in one scene and i’d like each of them to react to different VisibleOnScreenNotifiers. Is that even possible or is there a different way how to determine if an object is in specific cameras view?

It’s visible on screen, not visible by camera. Visibility is determined as a part of rendering pipeline so it applies only to currently active camera (that renders the frame)

You could write a custom camera frustum check script though, if you don’t need to do it on massive amount of objects per frame.

I need it to work for just one object. I will probably end up using an area3D in the shape of an FOV of the camera, but this camera frustum check sounds useful. Do you have some examples of it or some thing I could go off? I am not really sure how to even begin to write something like this.

You could do the AABB vs frustum intersection test using physics engine collisions but you still need to construct the frustum shaped convex collider from planes returned by Camera3D::get_frustum().

The intersection can also be checked manually. I wrote both versions I think, quite some time ago and posted on another forum. Don’t have them locally sadly. If I manage to dig it up - I’ll post it. They nudged me to submit this into official docs cookbook/tutorial section but I didn’t get to it.

Here:

There’s AABB vs frustum check function in the code example.

Also a function that creates convex mesh collider from frustum planes, in code example in this post:

Both use manual frustum extraction by projecting rectangles because the code creates sub-frustums for selection boxes. You can simply use Camera3D::get_frustum() instead.

1 Like

Thank you. I will check it out.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.