[Papervision3D] lookAt(camera) method for as2

Tim Knip tim.knip at gmail.com
Sun Nov 11 18:20:40 PST 2007


Why not check the AS3 code?
Check org.papervision3d.objects.DisplayObject3D#lookAt inside as3...

Guess you could use that code in AS2 too (not sure though)

Tim

2007/11/11, Wouter Huizinga <mutimedia at iplus.co.za>:
> Ok I know that as2 has no built in methods for turning a plane to
> face the camera ( plane.lookAt( camera ) for as3 ), so I'm trying to
> do it manually.
> My trig leaves a lot to be desired and I was wondering if anyone has
> achieved what I'm looking for.
> Currently I've got this.
>
> for(i=0; i<sceneObjArray.length; i++){
>
>         plane = sceneObjArray[i];
>         var dx:Number = camera.x - plane.x;
>         var dy:Number = camera.y - plane.y;
>         var dz:Number = camera.z - plane.z;
>         var radiansYX:Number = Math.atan2(dy, dx);
>         var radiansYZ:Number = Math.atan2(dy, dz);
>         var radiansXZ:Number = Math.atan2(dx, dz);
>         plane.rotationX = (radiansYX * 180/Math.PI);
>         plane.rotationY = (radiansYZ * 180/Math.PI);
>         plane.rotationZ = (radiansXZ * 180/Math.PI);
>
> }
>
> so it is rotating according to the camera angle, but is not
> perpendicular to it.
> thanks in advance for any help on this.
>
> thanks
> Wouter
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>



More information about the Papervision3D mailing list