|Have a nice weekend!
Well ,Here in Israel the new week has just begun ;)

I will try to find for you a code snippet I wrote a while ago which does the
job

Michael

On Sat, Dec 11, 2010 at 9:43 PM, Miguel Kennedy <[email protected]> wrote:

> Can't seem to get this to work :(
>
> Here's my code
>
> var camForDirVector:Vector3D =
> camera.transform.deltaTransformVector(Vector3D.Z_AXIS);
> camForDirVector.normalize();
> var objectPosVector:Vector3D = new Vector3D(myMesh.x, myMesh.y,
> myMesh.z);
> objectPosVector.normalize();
> var dotProd:Number = camForDirVector.dotProduct(objectPosVector);
> var angle:Number = Math.acos(dotProd);
>
> Can't find any relation between the dotProd or the angle for when the
> object is outside the camera view area...
>
> Am I doing something wrong?
>
> On Dec 11, 5:42 pm, Miguel Kennedy <[email protected]> wrote:
> > Thanks so much Michael!
> >
> > I'll give it a try ;)
> >
> > Have a nice weekend!
> >
> > On Dec 11, 5:27 pm, Michael Iv <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Miguel ,I don't have something ready right away but this is easy .It
> goes
> > > like this:
> >
> > > +camera forward position vector
> > > +object position vector
> > > normalize both
> > > use Vector3D dotProduct() to get their dot product
> > > If you need an angle between them extract it by var
> > > angle:Number=Math.acos(dotProduct) (it is in radians)
> >
> > > On Sat, Dec 11, 2010 at 5:27 PM, Miguel Kennedy <[email protected]>
> wrote:
> > > > Hi Michael!
> >
> > > > Thanks for the quick reply!
> >
> > > > Regarding:
> >
> > > > "you can find if the object is in front of the camera view or
> > > > behind with dot product calculation(deriving the angle between camera
> > > > and
> > > > your object, or just checking dot-if negative its behind the camera)"
> >
> > > > Do you have any code example of how this can be done?
> >
> > > > Thanks so much for your time!
> >
> > > > On Dec 11, 3:19 pm, Michael Iv <[email protected]> wrote:
> > > > > you can check against frustum planes if the object outside its
> > > > > volume.(Although I am not sure these are accessible in the current
> > > > > version)Also you can find if the object is in front of the camera
> view or
> > > > > behind with dot product calculation(deriving the angle between
> camera and
> > > > > your object, or just checking dot-if negative its behind the
> camera).
> >
> > > > > On Sat, Dec 11, 2010 at 5:11 PM, Miguel Kennedy <
> [email protected]>
> > > > wrote:
> > > > > > Hey guys,
> >
> > > > > > Can anyone tell me how can I determine if a mesh is currently
> visible
> > > > > > by the camera on the scene?
> >
> > > > > > Is there a property in the mesh class that tells me that?
> >
> > > > > > Thanks!
> >
> > > > > --
> > > > > Michael Ivanov ,Programmer
> > > > > Neurotech Solutions Ltd.
> > > > > Flex|Air
> > > > |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://
> > > >www.meetup.com/GO3D-Games-Opensource-3D/
> > > > > Tel:054-4962254
> > > > > [email protected]
> > > > > [email protected]
> >
> > > --
> > > Michael Ivanov ,Programmer
> > > Neurotech Solutions Ltd.
> > > Flex|Air
> |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://www.meetup...
> > > Tel:054-4962254
> > > [email protected]
> > > [email protected]
>



-- 
Michael Ivanov ,Programmer
Neurotech Solutions Ltd.
Flex|Air |3D|Unity|
www.neurotechresearch.com
http://blog.alladvanced.net
http://www.meetup.com/GO3D-Games-Opensource-3D/
Tel:054-4962254
[email protected]
[email protected]

Reply via email to