Author Topic: Determinate if a Pivot3D is in the camera field of view or not  (Read 135 times)

Hi everyone,

The getRotation() method of Pivot3D always
   returns values from -90 to 90 degrees. Is it possible to get a rotation
   between -180 and 180 degrees (or  between 0 and 360)?

   

   I'm simply trying to determinate if a Pivot3D is "outside" of the
   camera field of view but can't find a proper way to do this.

Any
   advise would be appreciated.

Thanks!

Florian

Ariel Nehmad   «   Reply #1 on: April 14, 2012, 10:43:02 AM »
hi!, 

pivot3d has a property called inView that returns (approximately) if some mesh is or not in the viewport area.

note that this property only works for graphical objects, like mesh3d.

we use this property internally to only render objects that are in the current view.

Florian BERNARD   «   Reply #2 on: April 16, 2012, 07:48:57 AM »
Hi Ariel,

Thanks for your reply. This is the perfect answer ;)

Regards

Florian BERNARD   «   Reply #3 on: April 17, 2012, 01:22:23 PM »
Hi again,

Furthermore is it possible to get the rotation from -180 to 180 ? 

I need to save a default rotation value but, if I store for example 25°, it matches 2 possible rotations. Do you see what I mean?

Cheers,
Florian

Jason Huang   «   Reply #4 on: April 17, 2012, 02:14:06 PM »
Hi,Florian
I know what you exatcly mean. Somthing like -90=90 right?
Well, I have a very basic idea, hope that helps:)
var PivotRotarionY:Number
if(Pivot.getRotation().y<0)
{
PivotRotationY=(180-(Math.abs(Pivot.getRotation().y)%180));
}
else
{
PivotRotationY=Pivot.getRotation().y%180
}

well, this is what I suppose.....For the better answer, Ask Ariel:)