How to detect if object is being rendered?

Software: Away3D 4.x

antonio.lea, Newbie
Posted: 25 July 2012 08:48 AM   Total Posts: 19

I read through all the gold version doc but I couldn’t find an answer to this.
I would like to know how to detect if object is not in the field of view..  I need to change coordinates of objects not in the fov..  Any help would be greatly appreciated.

   

Richard Olsson, Administrator
Posted: 25 July 2012 09:14 AM   Total Posts: 1192   [ # 1 ]

The bound objects on meshes have a method called isInFrustum(), which accepts a model-view-projection matrix. To get hold of that matrix, depending on where you are in the render loop, you might have to calculate it yourself. You can see how that’s done in the Entity.pushModelViewProjectoin() though, so it shouldn’t be too difficult.

So, to recap:
1. Get the MVP matrix (e.g. calculate it from the camera by mimicking the approach in Entity.pushModelViewProjection())
2. Pass the MVP into myMesh.bounds.isInFrustum() which will return a boolean.

   

antonio.lea, Newbie
Posted: 25 July 2012 05:28 PM   Total Posts: 19   [ # 2 ]

Thanks so much Richard.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X