rex_canvas_pixelcollide
Introduction
Test pixel overlapping between sprite and canvas.
Test pixel overlapping between sprite and canvas.
Usage
Prepare
Put this behavior in sprite. (not canvas)
Put this behavior in sprite. (not canvas)
Overlapping test
"Condition:Is overlapping another canvas", or "Condition:Is overlapping at offset" will return true if any pixel is inside the collision polygon of this object.
"Condition:Is overlapping another canvas", or "Condition:Is overlapping at offset" will return true if any pixel is inside the collision polygon of this object.
Sample rate
Property "Sample rate" is used to set the point count of overlapping testing, in percentage.
For example, if the object size is 40x40 = 1600 points, and the sample rate is 0.01, this behavior only pick 1600*0.01 = 16 points randomly at most in the boundary box of this object. It will first check if the alpha of this pixel is equal to 0 or not, then check the position of this pixel is in the collision polygon or not.
Property "Sample rate" is used to set the point count of overlapping testing, in percentage.
For example, if the object size is 40x40 = 1600 points, and the sample rate is 0.01, this behavior only pick 1600*0.01 = 16 points randomly at most in the boundary box of this object. It will first check if the alpha of this pixel is equal to 0 or not, then check the position of this pixel is in the collision polygon or not.
Push out
Sample capx
Call "Action:Push out", or "Action:Push out at angle" could push the sprite out of any pixel of canvas.
Sample capx
Call "Action:Push out", or "Action:Push out at angle" could push the sprite out of any pixel of canvas.
Bounce
Sample capx
Get bounce angle by "Expression:BounceAngle" while the sprite is overlapping with any pixel of canvas.
Sample capx
Get bounce angle by "Expression:BounceAngle" while the sprite is overlapping with any pixel of canvas.