Wanzyee Studio

Filter raycasts by a mask UnityEngine.Texture2D for non-rectangle area of effect. More...

Inherits MonoBehaviour, and ICanvasRaycastFilter.

Public Member Functions

bool IsRaycastLocationValid (Vector2 sp, Camera eventCamera)
 Check if the raycast valid, i.e., the hit mask pixel is over the threshold. More...
 

Public Attributes

Texture2D mask
 The readable UnityEngine.Texture2D as the filter mask. More...
 
ColorChannel channel = ColorChannel.A
 The channel to read the mask pixels. More...
 
float threshold
 The minimum pixel value to pass raycasts. More...
 
bool reverse
 The flag to reverse the threshold as maximum. More...
 

Detailed Description

Filter raycasts by a mask UnityEngine.Texture2D for non-rectangle area of effect.

Member Function Documentation

bool IsRaycastLocationValid ( Vector2  sp,
Camera  eventCamera 
)

Check if the raycast valid, i.e., the hit mask pixel is over the threshold.

Parameters
spScreen position.
eventCameraRaycast camera.
Returns
true if raycast valid; otherwise, false.

Member Data Documentation

Texture2D mask

The readable UnityEngine.Texture2D as the filter mask.

The channel to read the mask pixels.

float threshold

The minimum pixel value to pass raycasts.

bool reverse

The flag to reverse the threshold as maximum.