Still trying to detect the collision on planes with alphaBlended textures.
I already have the uv coordinates to check if picked color is transparent.
First I needed to activate pixelblender detection:
mesh.mouseEnabled = true;
mesh.pickingCollider = PickingColliderType.PB_BEST_HIT;
mesh.shaderPickingDetails = true;
mesh.geometry.convertToSeparateBuffers();
Anyway I already had a problem, because I was also using an animated SpriteSheetMaterial that uses different ScaleUV and OffsetUV in every frame, and UV coordinates given by PBPickingCollider.testSubMeshCollision doesn’t takes this params (UV values were allways relative to tho whole spritesheet, not the current frame portion).
I needed to path this issue (that maybe should be solved), by transforming _pickingCollisionVO.uv taking current animation frame values:
public function isTouchingSolid(mesh:Mesh, uv:Point):Boolean
{
var frame:SpriteSheetAnimationFrame = SpriteSheetAnimator(mesh.animator).frame;
var uvTransform:Matrix = new Matrix();
uvTransform.identity();
uvTransform.scale(frame.scaleU, frame.scaleV);
uvTransform.translate(frame.offsetU, frame.offsetV);
uv = uvTransform.transformPoint(uv);
var bmd:BitmapData = BitmapTexture(SpriteSheetMaterial(mesh.material).texture).bitmapData;
var x:uint = uint( bmd.width * uv.x );
var y:uint = uint( bmd.height * uv.y );
var color:uint = bmd.getPixel32(x, y);
return color != 0;
}
New issue submited in GitHub:
https://github.com/away3d/away3d-core-fp11/issues/630