Class SphereInteractionCaster
Implementation of InteractionCasterBase that performs a sphere cast with a set radius to find valid targets.
Inheritance
SphereInteractionCaster
Implements
Inherited Members
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: UnityEngine.XR.Interaction.Toolkit.Interactors.Casters
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[DisallowMultipleComponent]
[AddComponentMenu("XR/Interactors/Sphere Interaction Caster", 22)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Interactors.Casters.SphereInteractionCaster.html")]
public class SphereInteractionCaster : InteractionCasterBase, IInteractionCaster
Properties
castRadius
Radius of the sphere cast.
Declaration
public float castRadius { get; set; }
Property Value
Type | Description |
---|---|
float |
physicsLayerMask
Gets or sets layer mask used for limiting sphere cast and sphere overlap targets.
Declaration
public LayerMask physicsLayerMask { get; set; }
Property Value
Type | Description |
---|---|
LayerMask |
physicsTriggerInteraction
Determines whether the cast sphere overlap will hit triggers.
Declaration
public QueryTriggerInteraction physicsTriggerInteraction { get; set; }
Property Value
Type | Description |
---|---|
QueryTriggerInteraction |
Methods
InitializeCaster()
Tries to initialize the caster.
Declaration
protected override bool InitializeCaster()
Returns
Type | Description |
---|---|
bool | Returns true if successful or already initialized. |
Overrides
OnDisable()
See MonoBehaviour.
Declaration
protected virtual void OnDisable()
OnEnable()
See MonoBehaviour.
Declaration
protected virtual void OnEnable()
TryGetColliderTargets(XRInteractionManager, List<Collider>)
Gets an unsorted list of collider targets
Declaration
public override bool TryGetColliderTargets(XRInteractionManager interactionManager, List<Collider> targets)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionManager | interactionManager | XR Interaction manager reference |
List<Collider> | targets | List of target colliders to populate. |
Returns
Type | Description |
---|---|
bool | Returns true if collider targets were found. |