Is Object in Camera View?

How can I check whether an object is in a camera's field of view (return boolean)? 

Comments

  • EsemwyEsemwy Posts: 578
    edited May 2022

    Unless there's a function to do it, I believe you're stuck doing the math. If you know the direction you're facing and the field of view angle, you should be able to calculate the direction to each of the points in the bounding box of the object in question. My linear algebra is too weak to give efficient equations, but you should be able to do it with trigonometry. 
     

    Edit: DzBox3::testIntersection will probably get you most of the way there in combination with the methods in Dz3DViewport

    Post edited by Esemwy on
  • barbultbarbult Posts: 24,244

    mCasual has a script that you could look at to probably give you some clues. I'm not sure if/how that would translate to the SDK, though.

Sign In or Register to comment.