3D position to 2D using View3D.project

Software: Away3D 4.x

Len, Newbie
Posted: 02 November 2012 04:26 PM   Total Posts: 1

Hello!
As is clear from the problem I’ve outlined below, I’m fairly new to Away3D but have spent several days digging in and learning and trying things.

I’m trying to get a 3D space position translated to a 2D position in screen coordinates.
I found the View3d.project function and figured that was the way to go.
However, I’ve found the resulting screen coordinate to be off UNLESS my View3D is square.

So this gives an accurate screen x/y:
view = new View3D();
view.camera.lens = new PerspectiveLens(55);
view.width = 800;
view.height = 800;
Vector3D screenPos = view.project( TARGET_VEC3D_LOCATION );

But this doesn’t:

view.width = 1200;
view.height = 800;

The x coordinate is off. Clearly related to the View’s non-square aspect ratio.

Researching the forum (and web) I’ve found lots of people getting help going from 2D to 3D but no one else having this (reverse) issue.

Any suggestions? Thanks.
-Len

PS: I’m using 4.0.9 Gold on Mac (Lion).

   

Avatar
alihm, Jr. Member
Posted: 03 November 2012 11:45 AM   Total Posts: 49   [ # 1 ]

Strange, It works without problem for me. but If it’s related to the aspect ratio you can easily calculate the correct x coords.

   
   
‹‹ Maya 2012 Workflow

X

Away3D Forum

Member Login

Username

Password

Remember_me



X