Look at the showNormals part in bitmapMaterial or FaceLink for hints...
Sent from an iPhone without Flash
On Jun 29, 2010, at 10:30, Michael Iv <[email protected]> wrote:
I don't have the a ready code but you should do it this way:
Each face has 3 vertices.Each vertex has a position vector
number3D.You take these 3 vertices positions and find their average
so that to have the new position in the middle of the face.Now you
want the cube to be at some distance from the face.Here comes the
magnitude=length of the vectors. Multiply each component of the
average position vector by some factor that you should figure out
for yourself for needed distance.Or use Number3D.scale() function
that does just the same.And you will have you object at a distance
opposite the wanted face. Normals approach is the same but you dont
need to calc vertices average or something like that as normal is
already positioned in the middle of the face and is Number3D by
itself.
Hope it helps
Cheers
On Tue, Jun 29, 2010 at 11:11 AM, Fred <[email protected]>
wrote:
because i'm not able to do it ;-)
i'm a little bit confused with normals, can you leave me an example to
show me the way ?
thanks.
On 29 juin, 00:07, Michael Iv <[email protected]> wrote:
> 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
--
Michael Ivanov ,Programmer
Neurotech Solutions Ltd.
Flex|Air |3D|Unity|
www.neurotechresearch.com
http://blog.alladvanced.net
http://www.meetup.com/GO3D-Games-Opensource-3D/
Tel:054-4962254
[email protected]
[email protected]