hitTest()

hello

i dont found any hit test methods in any node objects.
how/where i can get coords of vertices of rotated sprite for calculating collision?
any ideas how get color alpha of pixel of rotated spite's texture?
 
Has invited:

lijh

Favor from: elmigo

For getting local coords of a rotated sprite and testing hit, you can use the codes below:
// Called every frame, if the behaviour is enabled.
Demo.prototype.update = function() {
var cursorPos = this.game.input.cursorPosition;
var localPos = this.sprite.toLocal(cursorPos);
console.log(localPos.x + ',' + localPos.y + ',' + 'hover:' + this.sprite.checkHit(localPos.x, localPos.y));
};

elmigo

Favor from:

thanks for solution,

any idea about picking pixel color? it needed for hit test by sprite alpha (in the next time)

To reply to a question, please Login or registered