// make sure you have these imported
import away3d.core.math.*;
import away3d.core.draw.*;
// make a new ENTER_FRAME listener and function or insert this code in
the ENTER_FRAME running already //////////
addEventListener( Event.ENTER_FRAME, onEnterFrame );
function onEnterFrame(event:Event):void
{
var SCREEN_VERTEX:ScreenVertex = view.camera.screen(3D_Object_NAME);
trace(SCREEN_VERTEX.x);
2D_Movieclip_NAME.x = SCREEN_VERTEX.x + view.x;
2D_Movieclip_NAME.y = SCREEN_VERTEX.y + view.y;
}
///////////////////////////////////////////////////////////////
Works for me.
On Jan 13, 10:07 am, Peter Kapelyan <[email protected]> wrote:
> I used to be able to do that - but as I am trying it's not working :/
>
> Maybe it'll work for you, I'm not having such a great day :O
>
> Also the vertices parameter in "camera.screen" is supposed to be optional:
>
> screenPlace(camera, myMovieClip, My3dObject, 1)//1=first vertice
>
> function screenPlace(camera,who,whob,vert):void {
> var result:ScreenVertex;
> result=camera.screen(whob,whob.vertices[vert]);
> who.x=result.x + 300;//half view width
> who.y=result.y + 200;//half view height
> }
> -Pete
>
> On Tue, Jan 13, 2009 at 12:59 PM, phreakquency <[email protected]>wrote:
>
>
>
> > I second that, this needs to be explained by anyone who knows!
>
> > On Jan 13, 8:44 am, smint <[email protected]> wrote:
> > > I want to display a 2D TextField next to a 3D object, which moves. Is
> > > there a way to convert a 3D (x, y, z) location to a 2D (x, y) location
> > > in the this context?
>
> > > Thanks a lot.
>
> --
> ___________________
>
> Actionscript 3.0 Flash 3D Graphics Engine
>
> HTTP://AWAY3D.COM