Gabe, Here is the code again a bit more readable. I forgot how this forum wraps text.
// make a new vertex using the event.sceneX,Y,Z var v:Vertex = new Vertex(e.sceneX,e.sceneY, e.sceneZ); // create a few blank matrix //this could be done with fewer lines but //I wanted to step this through var m:Matrix3D = new Matrix3D(); var m2:Matrix3D = new Matrix3D(); var m3:Matrix3D = new Matrix3D(); // get the translation of the nested ObjectContainer3D m.clone(this._innerContainer.transform); // get the translation of the outer most ObjectContainer3D m2.clone(this._outerContainer.transform); // (you would continue the above for every nested level. // I only had two levels) // combine these two translations m3.multiply(m2,m); // inverse that result m.inverse(m3); // then ally the transform to the vertex that represents the localized mouse click. (v.x, v.y, v.z) v.transform(m); Now you can see the result here: http://www.directresponsemedicine.com/flexsandbox/trek/ Click and drag to rotate the entire scene. Then click on most any object to "shoot" it. You will see the phasors point at the very point you clicked (not just center object), also the explosion will show at the correct location. The phasor objects are nested three levels deep. I hope this helps. Tony On Oct 29, 6:09 am, mogg <[EMAIL PROTECTED]> wrote: > Gabe, > > I just dealt with this same issue > here:http://groups.google.com/group/away3d-dev/t/9ddef57b20ff93f4 > > I have two ObjectContainer3Ds. One inside the other. Inside that last > ObjectContainer3D I have all my objects that are moving around. > > To translate the MouseEvent3D.sceneX,Y,Z to local coordinates I have > to do the following: > > var v:Vertex = new Vertex(event.sceneX,event.sceneY, event.sceneZ); // > make a new vertex using the event.sceneX,Y,Z > var m:Matrix3D = new Matrix3D(); // create a few blank matrix (this > could be done with fewer but I wanted to step this through > var m2:Matrix3D = new Matrix3D(); > var m3:Matrix3D = new Matrix3D(); > m.clone(this._innerContainer.transform); // get the translation of the > nested ObjectContainer3D > m2.clone(this._outerContainer.transform); // get the translation of > the outer most ObjectContainer3D > // (you would continue the above for every nested level. I only had > two levels) > m3.multiply(m2,m); // combine these two translations > m.inverse(m3); // inverse that result > v.transform(m); // then ally the transform to the vertex that > represents the localized mouse click. (v.x, v.y, v.z) > > Now you can see the result > here:http://www.directresponsemedicine.com/flexsandbox/trek/ > Click and drag to rotate the entire scene. Then click on most any > object to "shoot" it. You will see the phasors point at the very point > you clicked (not just center object), also the explosion will show at > the correct location. The phasor objects are nested three levels deep. > > I hope this helps. > > Tony > > On Oct 29, 4:24 am, gabe <[EMAIL PROTECTED]> wrote: > > > > > If I am right, MouseEvent3D is fired only for the _first_ hit object. > > If this is true, here comes my question: Is it possible to get a > > MouseEvent3D for _all objects_ that have been hit ? I have multiple > > objects nested in each other, and I would like to get a MouseEvent3D > > for each one of them I have assigned a onMouseDown handler via > > addOnMouseDown(); > > > cheers, > > Gabriel.- Hide quoted text - > > - Show quoted text -
