C# Class ScreenRaycaster, swip3

Inheritance: MonoBehaviour
ファイルを表示 Open project: unit9/swip3 Class Usage Examples

Public Properties

Property Type Description
Cameras Camera[]
IgnoreLayerMask LayerMask
RayThickness float
VisualizeRaycasts bool

Public Methods

Method Description
Raycast ( Vector2 screenPos, RaycastHit &hit ) : bool
Start ( ) : void

Private Methods

Method Description
Raycast ( Camera cam, Vector2 screenPos, RaycastHit &hit ) : bool

Method Details

Raycast() public method

public Raycast ( Vector2 screenPos, RaycastHit &hit ) : bool
screenPos Vector2
hit UnityEngine.RaycastHit
return bool

Start() public method

public Start ( ) : void
return void

Property Details

Cameras public_oe property

List of cameras to use for each raycast. Each camera will be considered in the order specified in this list, and the Raycast method will continue until a hit is detected.
public Camera[] Cameras
return Camera[]

IgnoreLayerMask public_oe property

Layers to ignore when raycasting
public LayerMask IgnoreLayerMask
return LayerMask

RayThickness public_oe property

Thickness of the ray. Setting rayThickness to 0 will use a normal Physics.Raycast() Setting rayThickness to > 0 will use Physics.SphereCast() of radius equal to half rayThickness ** IMPORTANT NOTE ** According to Unity's documentation, Physics.SphereCast() doesn't work on colliders setup as triggers
public float RayThickness
return float

VisualizeRaycasts public_oe property

Property used while in the editor only. Toggles the visualization of the raycasts as red lines for misses, and green lines for hits (visible in scene view only)
public bool VisualizeRaycasts
return bool