Here's an excerpt from some code I did that picks faces on an object:

private function onMouseDown(event:MouseEvent3D):void {
                var sphere:Sphere = event.target as Sphere;
                if (event.drawpri is DrawTriangle) {
                    var face:Face = (event.drawpri as
DrawTriangle).faceVO.face as Face;
                    /* Your code using the face */
                }
}

Once you have the face object from your click event, you can use its
attributes to determine the size and location of the cube you want to
create.  You'll likely want to position and align your cube along the
normal of the selected face.

You can see the full code here: 
http://savagelook.com/demos/face_picking/sandbox.html
(right click on the view to view source)

On Jun 28, 12:47 pm, Fred <[email protected]> wrote:
> Hi,
>
> I'm trying to create an app where the user can add a cube after
> cliking on an object.
> (This object is coming from a 3ds model, it's a cube but i need it
> comes from 3ds.)
>
> Today, i can detect the click on an object and create the cube at the
> point clicked (using the mouse3dEvent infos).
>
> But now i need to create a cube with the same size than the face
> clicked and i don't find a simple way to do it .
>
> Any help is welcome !
>
> thanks.
> Fred

Reply via email to