« Return to Thread: 3D >> 2D coordinates

Re: 3D >> 2D coordinates

by julapy :: Rate this Message:

Reply to Author | View in Thread

Thanks for your help.
I found another solution shortly after posting by going back through the papervision emails.

        public function getObj2DCords ( o:DisplayObject3D, camera:CameraObject3D,  offsetX:Number = 0, offsetY:Number = 0 ):Point
        {
            var view:Matrix3D = o.view;
            var persp:Number = (camera.focus * camera.zoom) / (camera.focus + view.n34);
            return new Point ( (view.n14 * persp) + offsetX, (view.n24 * persp) + offsetY );
        }

seems to do the trick nicely.


On Jan 10, 2008 10:11 PM, Makc <makc.the.great@...> wrote:
in dod3d you have:

public var screen :Number3D = new Number3D();
...
private function calculateScreenCoords( camera :CameraObject3D ):void
{
       var persp:Number = (camera.focus * camera.zoom) / (camera.focus + view.n34);
       screen.x = view.n14 * persp;
       screen.y = view.n24 * persp;
       screen.z = view.n34;
}

perhaps simply changing calculateScreenCoords( to public would help.


On 1/10/08, Dennis Ippel <ippeldv@...> wrote:

> This'll do it:
>
> http://osflash.org/pipermail/papervision3d_osflash.org/2007-August/010225.html
>
>
>
> On Jan 10, 2008 9:48 AM, Lukasz Karluk <julapy@... > wrote:
> >
> > hi, im working on a project at the moment with papervision 1.7b
> > im running MovieScene3D with a few Planes scattered randomly all facing
> the camera.
> > i would like to add movie clips over the 3D scene based on the coordinates
> of the planes. more precisely, i need to convert 3D coordinates into 2D
> coordinates on the screen.
> > if anyone has done this before or has any idea on how it can be done, can
> you please point me in the right direction.
> >
> > cheers.
> > julaps
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D@...
> >
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: 3D >> 2D coordinates