Don't know about Away3D, but in general 3D.

Formula what you thinking of is old school and likely no longer valid
in Away3D4. You should be looking for something like perspective
matrix and view matrix. If you have point location in world space you
should be able to calculate 2d position.

First multiply view matrix and perspective matrix.
resmat = viewmat * persmat
Then project your point with resulting matrix.
p.project(resmat) this return position in 2d coords or in canocanial
space (depends of 3d api) if canonical space then you normalized
values and you need to scale them up with your resolution like
p.x *= resolutionX / 2.0;
p.y *= resolutionY / 2.0;

However this done in Away3D4 is another thing and where I can't help
you.

On 14 maalis, 08:55, sascha <[email protected]> wrote:
> Anyone know how to calculate a 3D coord of an ObjectContainer3D to 2D
> in Away3D Broomstick? I remember some very simple formula like
>
>                         var p:Vector3D = _container3D.sceneTransform.position;
>                         var x:Number = p.x / p.z;
>                         var y:Number = p.y / p.z;
>
> ... but this doesn't work. I guess there's more to it than that but I
> can't figure it out so far.

Reply via email to