Why don't you use face normals or face vertices to calc the coords.
Then use vector scalar multiplication in order to position you object
some distance from the given face
Sent from my iPhone
On Jun 28, 2010, at 11:34 PM, savagelook
<[email protected]> wrote:
honestly, im not sure how to do that in away3d. away3dlite on the
other hand draws quads when possible and its really easy. Maybe
someone else with deeper knowledge of how the primitives are drawn can
help.
On Jun 28, 3:58 pm, Fred <[email protected]> wrote:
ok, thanks for the demo !
but i need to create a cube that equals to 2 triangles, so i need to
know which are the two triangles for creating a corresponding cube in
front of this 2 triangles ?
On 28 juin, 19:12, savagelook <[email protected]> wrote:
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