[Papervision3D] how to make do3d lookat camera

gaz at squidsoup.com gaz at squidsoup.com
Wed Nov 5 03:13:22 PST 2008


 

	  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }
there may be a more conventional way to do it but i have done it like
this in the past, basically i make it point at a position that is a
standard distance from the object rather than the variable distace
that arises if you are always pointing directly at the camera.   

	  var targ:DisplayObject3D = camera;
   var do3d:DisplayObject = object_pointing_at_camera; 
   var targPos:DisplayObject3D = DisplayObject3D.ZERO; 
    var diff:Number3D = Number3D.sub(new
Number3D(do3d.x,do3d.y,do3d.z), new Number3D(targ.x,targ.y,targ.z))
    diff.normalize()
    diff.multiplyEq(10)
    targPos.x = diff.x + do3d.x
    targPos.y = diff.y + do3d.y
    targPos.z = diff.z + do3d.z
    do3d.lookAt(targPos, new Number3D(0,0,1)) 

	you may need to do post transformations on the display object but
that depands on its identity transform.
 gaz 
 www.fayju.com 
 www.squidsoup.org 
 On Wed 05/11/08 12:41 AM , niki77 niki_yim at hotmail.com sent:
 i have a DAE which has children
 some of them are just planes for billboard
 so i tried this way:
 tick()
 {
 // camera is default from BasicView
 camera.orbit(ry,rx);
 if(_dirty)
 {
 dae.getchildbyname("bboard01",true).lookat(camera);
 ...
 }
 singlerender();
 }
 but the result wasn't what i expected
 the planes' direction distorted and didn't look at my camera
 can anybody point me the way to get it done
 -- 
 View this message in context:
http://www.nabble.com/how-to-make-do3d-lookat-camera-tp20334455p20334455.html
[1]
 Sent from the Papervision3D mailing list archive at Nabble.com.
 _______________________________________________
 Papervision3D mailing list
 Papervision3D at osflash.org [2]
 http://osflash.org/mailman/listinfo/papervision3d_osflash.org [3]


Links:
------
[1]
http://www.nabble.com/how-to-make-do3d-lookat-camera-tp20334455p20334455.html
[2] mailto:Papervision3D at osflash.org
[3] http://osflash.org/mailman/listinfo/papervision3d_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20081105/ff5384a9/attachment.html>


More information about the Papervision3D mailing list