Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17070

Cocos Creator Alpha Hit Test

$
0
0

@Dazlonar wrote:

Hello.

I want to handle the touch event on a sprite and ignore it when i touch the alpha area of the sprite’s texture.
I can't find any solution for "Cocos Creator".

I find some solution for default cocos2d-x js:

var renderTexture = new cc.RenderTexture(cc.winSize.width, cc.winSize.height);

renderTexture.begin();
object.visit();

var pixels = new Uint8Array(4);
gl.readPixels(location.x, location.y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixels);

renderTexture.end();

But when i using this code for cocos creator i get an error Sorry, cc.Node.visit is removed

Someone have any ideas how to do alpha hit test for sprite in Cocos Creator?

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 17070

Trending Articles