picking through transparency

Software: Away3D 4.x

Koga73, Newbie
Posted: 13 December 2012 10:15 PM   Total Posts: 13

Hi I have a number of planes that are layered. Some planes have transparent areas within the texture. I am wanting to pick through the transparency…

Example I have Plane A and Plane B. Plane A has a transparent area and is in front of Plane B. I want to be able to pick Plane B by clicking on it through the transparency of Plane A.

Any suggestions on how I could accomplish this?
Thanks

   

Koga73, Newbie
Posted: 14 December 2012 05:04 PM   Total Posts: 13   [ # 1 ]

Since nobody’s responded I guess that means there isn’t a simple way to do this. That being said I’ve come up with a plan.

On the planes mouse click I grab the uv coordinates of where the click took place. Figure out what pixel that should be in the BitmapData and grab the pixel32 for that point. If its alpha is above a certain threshold I consider it transparent and negate the scenePosition vector and use this to raycast until I get another hit.

Seems like it should work although I’m having some trouble getting the UV of where the MouseEvent3D took place.

For my scene I’m using:
view.mousePicker = PickingType.RAYCAST_BEST_HIT;

With that alone I get null for the mouseEvent.uv property. Setting the picking collider on the mesh gets rid of the null value but the uv is still not correct. Using the AutoPickingCollider or AS3PickingCollider on the mesh results in the uv being (0-1, 1). The x value varies corretly based on where I click but the y value is always 1. This seems like a bug?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X