I'm wondering what's the most efficient way to detect whether or not an object is entirely within the current camera's field of view. For example, if I'd want to allow variations in camera rotation until the object is at the edge of the field of view, so to speak.

Is there an easy way to do this?



1 Answer 1


Yes there's an easy way, go to the BGE Documentation to look for more information. Since you dont specified if you are using bpy or bge i go for bge.

from bge import logic
cont = logic.getCurrentController()
cam = cont.owner

# Test point [0.0, 0.0, 0.0]
if (cam.pointInsideFrustum([0.0, 0.0, 0.0])):
  # Point is inside frustum !
  # Do something useful !
  # Box is outside the frustum !
  • $\begingroup$ I was using bpy, but I should probably switch to bge anyway. Thanks! $\endgroup$
    – Jack Lynch
    Apr 4, 2017 at 14:12
  • $\begingroup$ BGE is no longer supported. Is there away to do this using BPY? $\endgroup$
    – pookie
    Dec 5, 2022 at 17:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .