Away3DLite: 2D coordinates to 3D position...

279 views
Skip to first unread message

elguapoloco

unread,
Mar 24, 2010, 7:43:25 AM3/24/10
to Away3D.dev
Hi,

Is there a simple way of positioning a 3D object to always be at the
same screen position? I have a targeted camera and need for one object
to always be at the same stage position (top left). Any suggestions
welcome!

thank you,

Jerome.

Peter Kapelyan

unread,
Mar 24, 2010, 9:24:51 AM3/24/10
to away3...@googlegroups.com
You can position it to the camera, with the same rotations, then do a simple moveForward and moveLeft

Let em know if it makes sense
-Pete

To unsubscribe from this group, send email to away3d-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.



--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

elguapoloco

unread,
Mar 24, 2010, 2:01:11 PM3/24/10
to Away3D.dev
Hi Peter!

I am using Away3D lite and it doesn't provide the moveForward,
moveLeft shortcuts, or does it?

Cheers,

Jerome

Peter Kapelyan

unread,
Mar 24, 2010, 2:21:41 PM3/24/10
to away3...@googlegroups.com
Ooops that always happens to me (eyes go over the word 'lite') sorry, not sure there :/


Jerome

To unsubscribe from this group, send email to away3d-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

elguapoloco

unread,
Mar 24, 2010, 9:15:28 PM3/24/10
to Away3D.dev
I just can't seem to figure it out... I am sure it's easy as pie, too!
Maybe this could help: Anyone knows how to get the coordinates
(Vector3D) of the top left corner of a Plane in Away3DLite?

I managed to target the camera to a Plane and have that plane looks at
the camera. It defines a nice rectangle where the top left corner
would be the spot where my navigation should seat. I can get the
coordinates with a MouseEvent3D (using the event.scenePosition) but I
don't know how to generate that using UVs in Lite...

I'll upload a screencap of the setup: jj-plane-screencap.png

Last resort would be to create a separate scene for that nav... But I
am sure there's a way!

Thank you,

Jerome.

elguapoloco

unread,
Mar 24, 2010, 10:23:36 PM3/24/10
to Away3D.dev
I finally figured it out! It was as simple as looking inside the
View3D class and grabbing the code to return the scene position of the
MouseEvent3D... Duh.

Here's the "general idea" code:

var scenepos:Vector3D;
var p:Point = new Point(-400, 50);
var uvt:Vector3D = _targetNull.faces[0].calculateUVT(p.x, p.y);
scenepos = camera.lens.unProject(p.x, p.y, uvt.z);
scenepos = camera.transform.matrix3D.transformVector(scenepos);
navigation.updatePosition( scenepos );

Target null is an invisible plane that's used to target the camera and
it itself looks at the camera... Works like a charm!!!

I'll upload a screen cap :P

Cheers,

Jerome.

Rob Bateman

unread,
Mar 29, 2010, 9:22:55 PM3/29/10
to away3...@googlegroups.com
Hey Jerome. thanx for posting your solution - good job!

Rob

To unsubscribe from this group, send email to away3d-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.



--
Rob Bateman
Flash Development & Consultancy

rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com

Rob Bateman

unread,
Mar 29, 2010, 9:25:51 PM3/29/10
to away3...@googlegroups.com
things like moveForward(), moveBack() etc are not in Lite because they exist in the native Matrix3D class in Flash 10 under a different guise....

http://groups.google.com/group/away3d-dev/browse_thread/thread/c90cace71a6aa5b5/f55625b2aa532ccc

cheers

Rob
Reply all
Reply to author
Forward
0 new messages