Get polygon under mouse

Software: Away3D 4.x

izabel, Newbie
Posted: 16 February 2014 02:46 PM   Total Posts: 2

Hi everyone.

I can’t find out how to get polygon under mouse. I want to do something like this: when mouse move some polygon, need to change color of it (see image). It is real?

 

   

Avatar
Mu Duck, Newbie
Posted: 16 February 2014 06:56 PM   Total Posts: 20   [ # 1 ]

Of course it is.

Start with this guide:
http://away3d.com/tutorials/Introduction_to_Mouse_Picking

In your case you need to get raycastpickerVO object and it will have some “index” property. This is is the index of triangle in the mesh under your mouse.

You can get vertex coordinates of this triangle using vertexData and IndexData of the mesh geometry (look the code of as3picker to understand how to get the right numbers out of these vectors). When you know the coordinates you can just build that triangle as a separate mesh. Also there are some methods to apply textures to subgeometries, if you dont want separate mesh, but I havent experimented with it yet, so cant help here.

   

izabel, Newbie
Posted: 17 February 2014 11:10 AM   Total Posts: 2   [ # 2 ]

Thanks for your reply!

Mu Duck - 16 February 2014 06:56 PM

In your case you need to get raycastpickerVO object and it will have some “index” property. This is is the index of triangle in the mesh under your mouse.

But how I can get this magic object? Is there some example of using it?
(I’m new to Away3D, sorry)

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X