Ah, my mistake. This is what you want:

((myMouseEvent.drawpri as DrawSegment).elementVO as SegmentVO).segment;


and yes, this should be available right now in the trunk!

atb

Rob


On Tue, May 12, 2009 at 1:21 AM, scott <[email protected]> wrote:

>
> Thanks - really appreciate it.  Just to be clear, this update is
> already in there or will be later?  I tried it out after updating and
> didn't see the MouseEvent3D event.object coming back as a Segment, but
> I may be doing something wrong, so I can pound on it more if the
> update is actually already in there.
>
> Thanks again,
>
> Scott
>
> On May 10, 9:49 am, Rob Bateman <[email protected]> wrote:
> > Hey Scott
> >
> > A recent update made on the engine now has source being updated for
> > DrawSegment objects to point of the original Segment object that it was
> > created for. This will carry across to mouse interaction, so
> > a click on a segment will now return a MouseEvent3D object that has
> > event.object as the Segment object for clicks on a DrawSegment
> >
> > hth!
> >
> > Rob
> >
> >
> >
> >
> >
> > On Thu, Apr 23, 2009 at 9:05 PM, scott <[email protected]> wrote:
> >
> > > Hello,
> >
> > > Hopefully someone can give some insight on this - I searched the forum
> > > and it doesn't look like this one's been answered before.  I'm trying
> > > to figure out how to get a Segment from a DrawSegment.  For instance,
> > > if the user clicks on a DrawSegment on the screen, I'd like to figure
> > > out the Segment that that DrawSegment corresponds to in the clicked
> > > Mesh/Object3D.  For a DrawTriangle you can retrieve the corresponding
> > > face object by referencing (myMouseEvent.drawpri as
> > > DrawTriangle).faceVO.face, but I don't see any similar way to do this
> > > for a DrawSegment.
> >
> > > So far I tried getting the two ScreenVertex endpoints of the
> > > DrawSegment and using deperspective() to convert those ScreenVertices
> > > to Vertices, creating a new Segment with the Vertices, then comparing
> > > that Segment to Segments contained in the clicked Mesh in order to
> > > find the corresponding one.
> >
> > > Here's the code at the core of it -
> >
> > > function GetSegmentFromDrawSegment(drawSegment:DrawSegment):Segment
> > > {
> > >        var screenV0:ScreenVertex = drawSegment.v0;
> > >        var screenV1:ScreenVertex = drawSegment.v1;
> > >        var v0:Vertex;
> > >        var v1:Vertex;
> > >        var segment:Segment;
> >
> > >        v0 = screenV0.deperspective(drawSegment.view.camera.focus);
> //get
> > > vertex from screen vertex
> > >        v1 = screenV1.deperspective(drawSegment.view.camera.focus);
> >
> > >        segment = new Segment(v0, v1);
> >
> > >        return segment;
> > > }
> >
> > > However, when I run it, conversion of the DrawSegment ScreenVertices
> > > to Vertices gives position (x,y,z) values that are way off of the
> > > actual corresponding Segment in the model, so I must be doing
> > > something wrong and/or misunderstanding how things work at the heart
> > > of the engine.  If anyone can offer advice I'd appreciate it.
> >
> > > Thanks,
> >
> > > Scott
> >
> > --
> > Rob Bateman
> > Flash Development & Consultancy
> >
> > [email protected] Hide
> quoted text -
> >
> > - Show quoted text -




-- 
Rob Bateman
Flash Development & Consultancy

[email protected]
www.infiniteturtles.co.uk
www.away3d.com

Reply via email to