Translations and MouseEvents

0 views
Skip to first unread message

mogg

unread,
Oct 28, 2008, 12:57:31 PM10/28/08
to away3d.dev
I have an ObjectContainer3D which contains a few other objects. Each
of these child object respond to a MouseEvent3D.

The ObjectContainer3D can be rotated in X,Y,and Z.

The Child objects are also moving around based on basic AI.

When I click a child object and get the resulting MouseEvent3D I
attempting to use the event.sceneX,Y,Z.

How can I translate this result to move a child object to the same
point inside the ObjectContainer3D?

Jensa

unread,
Oct 28, 2008, 1:17:32 PM10/28/08
to away3d.dev
I didn't get that. Could you please try explaining again?

J

Rob Bateman

unread,
Oct 28, 2008, 1:19:12 PM10/28/08
to away3...@googlegroups.com
Hmm, nothing we have in the engine will do this for you, but you could always try and write a little 'globalToLocal" method for obejct3d to do just that yourself. Essentially you need to take the x y and z positions in the scene and multiply the resulting number3d by the inverse matrix3d of the sceneTransform property of the object.

Rob
--
Rob Bateman
Flash Development & Consultancy

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

mogg

unread,
Oct 28, 2008, 1:48:03 PM10/28/08
to away3d.dev
Rob,

Thank you. I will try that.

Tony

On Oct 28, 10:19 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> Hmm, nothing we have in the engine will do this for you, but you could
> always try and write a little 'globalToLocal" method for obejct3d to do just
> that yourself. Essentially you need to take the x y and z positions in the
> scene and multiply the resulting number3d by the inverse matrix3d of the
> sceneTransform property of the object.
>
> Rob
>
> On Tue, Oct 28, 2008 at 4:57 PM, mogg <tonyghe...@gmail.com> wrote:
>
> > I have an ObjectContainer3D which contains a few other objects. Each
> > of these child object respond to a MouseEvent3D.
>
> > The ObjectContainer3D can be rotated in X,Y,and Z.
>
> > The Child objects are also moving around based on basic AI.
>
> > When I click a child object and get the resulting MouseEvent3D I
> > attempting to use the event.sceneX,Y,Z.
>
> > How can I translate this result to move a child object to the same
> > point inside the ObjectContainer3D?
>
> --
> Rob Bateman
> Flash Development & Consultancy
>
> rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com

mogg

unread,
Oct 28, 2008, 9:59:41 PM10/28/08
to away3d.dev
Rob,

THANK YOU! Got it working as desired with your recommendations with
the current trunk... Thank you, Thank you, Thank you!

http://www.directresponsemedicine.com/flexsandbox/trek/

I can now rotate the scene in any direction and click on any object
(other than the center ship) and hit those objects with phasors in the
very spot I clicked. If I click on the nacel or bridge I get hits in
those specific areas. Again... Thank you!

I did the following to create a globalToLocal transformation:

var v:Vertex = new Vertex(event.sceneX,event.sceneY, event.sceneZ);
var m:Matrix3D = new Matrix3D();
var m2:Matrix3D = new Matrix3D();
var m3:Matrix3D = new Matrix3D();
m.clone(this._innerContainer.transform);
m2.clone(this._outerContainer.transform);
m3.multiply(m2,m);
m.inverse(m3);
v.transform(m);

Tony

mogg

unread,
Oct 29, 2008, 12:01:48 AM10/29/08
to away3d.dev
Jensa,

Don't worry. Rob's recommendation answered my question.

Tony
Reply all
Reply to author
Forward
0 new messages