GET triangle via MouseEvent position?

Software: Away3D 4.x

liquid, Newbie
Posted: 27 March 2012 04:14 PM   Total Posts: 8

Hej,

in previous posts you talked about the “HitTestRenderer” and it seems to be what I need. Unfortunately this class does not seem to be part of the latest revision. Is it coming soon again?

Or is there another/better way to find the polygon of the hit mouse coord on a mesh?

Thanks in advance!

   

Avatar
Fabrice Closier, Administrator
Posted: 27 March 2012 07:51 PM   Total Posts: 1265   [ # 1 ]

one easy is to set details true or unproject the ray and use the ray class, if hit, pass the results to BaryCentricTest class.

   

liquid, Newbie
Posted: 27 March 2012 08:29 PM   Total Posts: 8   [ # 2 ]

Thanks Fabrice, I’ll have a look!

   

GameDesigner, Jr. Member
Posted: 08 May 2012 03:33 PM   Total Posts: 33   [ # 3 ]
Fabrice Closier - 27 March 2012 07:51 PM

one easy is to set details true or unproject the ray and use the ray class, if hit, pass the results to BaryCentricTest class.

Hi Fabrice,
I’m trying to get the orientation of the polygons of a mesh that is under the mouse cursor.

I would like to snap an object3D and to another one that has irregular shapes.

Is there a way to get the normals informations of the polygons?

I’ve just found out only that I can get the mouse position on a mesh with event.sceneX, event.sceneY, event.sceneZ

Thanks.

 

   

Avatar
Fabrice Closier, Administrator
Posted: 08 May 2012 03:42 PM   Total Posts: 1265   [ # 4 ]

I see that the event doesn’t return the face indice (the pointer v0 in the indices buffer).—> on the todo smile

Using the Ray class however, you would have to loop over the faces yourself. on hit you would know…

   

GameDesigner, Jr. Member
Posted: 08 May 2012 03:52 PM   Total Posts: 33   [ # 5 ]
Fabrice Closier - 08 May 2012 03:42 PM

I see that the event doesn’t return the face indice (the pointer v0 in the indices buffer).—> on the todo smile

Using the Ray class however, you would have to loop over the faces yourself. on hit you would know…

/*** mesh listener for mouse move interaction*/
private function onMeshMouseMove(event:MouseEvent3D):void
{
 myIntersection
.visible true;
 
myIntersection.position = new Vector3Devent.sceneXevent.sceneYevent.sceneZ );
 
trace(myIntersection.position);
 
trace((event.object as Mesh).eulers);
 

I’ll try to get it with the Ray class. Thanks for your advice. An example would be really nice wink but maybe you don’t have the time for it too.

Thanks smile

   

Avatar
Fabrice Closier, Administrator
Posted: 08 May 2012 07:25 PM   Total Posts: 1265   [ # 6 ]

Search this forum, I recall posting an example in here a while ago.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X