How to get 3d object’s bounds with applied camera projection

Software: Away3D 4.x

Desmond Miles, Newbie
Posted: 28 January 2013 04:21 PM   Total Posts: 3

Hello, community!

Let’s presume I have a sphere and a camera with its default settings. What is the best way in Away3D 4 to get the bounds of the sphere as it is seen on screen (with applied camera projection)?

BoundingSphere does not help me, as it gives me the bounds of the sphere without any transformations applied to it.

I have searched for this problem with no luck.

I’m new here, by the way.

Cheers.

   

aeki, Member
Posted: 27 February 2013 09:34 PM   Total Posts: 73   [ # 1 ]

you should have a look at the Drag3D class as it deals with projection of 3D point to screen coordinates, this might help you.

   

beers, Member
Posted: 01 March 2013 11:13 PM   Total Posts: 53   [ # 2 ]

Is it the bounding box of the sphere in screen-space you want?

i’d use mesh.bounds.aabbPoints to get a vector list of your bbox points, then transform them using mesh.transform.transformVectors(A,B).

B is your new list of transformed bbox points. Then just do a view.project() on each vector in list B to get the screen-space points, and then calc the min/max of those points to get your final bounding rect in screen-space.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X