You can build a cube from six planes...so you don't really need to use a cube at all.
Place the 6 planes into an object container if you want to rotate them all together as a cube/group. Then you can use the "scenePosition" property of each face(plane) to get the coordinates in real space. Finally place a object3D at each of these 6 positions, it can be hidden or a "null" Object3D. Now you can use distanceTo(oneofthesixnulls) and you'll know which plane is the closest to whatever object/face you want! That's how I would do it, I'm not really big on math :/ Hope it makes sense. -Pete On Mon, Dec 8, 2008 at 12:22 PM, cellis <[EMAIL PROTECTED]>wrote: > > How could i place a plane on each of the faces? > > On Dec 8, 10:38 am, "Peter Kapelyan" <[EMAIL PROTECTED]> wrote: > > If your cube was made of 6 planes it might be easier, since you then have > > six objects (super easy). > > Otherwise you can also just set up 6 objects at the center of each face, > and > > you a compare with that... > > > > Just easy hacks, > > -Pete > > > > > > > > On Mon, Dec 8, 2008 at 10:01 AM, Li <[EMAIL PROTECTED]> wrote: > > > Well, I dont know if Away has any native tools for this kind of stuff, > but > > > if there isn't, what comes to my head is this: > > > > > You can obtain a vector from the object to the cube by comparing the 2 > > > objects' positions. Once this is done you can run line-plane > intersection > > > tests with each of the cubes faces obtaining a series of 3d numbers. > Once > > > you have these numbers you can analyze which one is nearest (I imagine > you > > > would have to compare 2 of the results, the rest would be null)... and > there > > > you go, you have a point in 3d space representing a point on the cube's > > > surface between the line joining the objects. > > > > > The only complex part is solving the mathematical problem of finding > the > > > intersection between a line and a plane, which you can google easily. > Its a > > > very common problem in maths. > > > > > Hope it helps, > > > Cheers! > > > > > On Mon, Dec 8, 2008 at 12:26 PM, cellis <[EMAIL PROTECTED] > >wrote: > > > > >> From an object in the same scene. I know i can say obj.distanceTo > > >> (cube). As for the position on the face, the nearest point is what i > > >> am looking for. > > > > >> On Dec 8, 12:12 am, Li <[EMAIL PROTECTED]> wrote: > > >> > Hey Cellis, > > > > >> > Maybe if you define your question a bit more I can help you. > > > > >> > From where? > > >> > To where? Any point in the face, nearest? > > > > >> > On Sun, Dec 7, 2008 at 11:15 PM, cellis < > [EMAIL PROTECTED] > > >> >wrote: > > > > >> > > Hello all, > > > > >> > > how could i find the distance to , for instance, the back xy face > of a > > >> > > cube? > > > > -- > > ___________________ > > > > Actionscript 3.0 Flash 3D Graphics Engine > > > > HTTP://AWAY3D.COM <http://away3d.com/> > -- ___________________ Actionscript 3.0 Flash 3D Graphics Engine HTTP://AWAY3D.COM
