Class CurveVisualController
Behavior designed to provide a versatile and configurable controller for a Line Renderer component, based on data provided from an interactor implementing ICurveInteractionDataProvider to visually represent it.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Interactors.Visuals
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[DisallowMultipleComponent]
[AddComponentMenu("XR/Visual/Curve Visual Controller", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Interactors.Visuals.CurveVisualController.html")]
public class CurveVisualController : MonoBehaviour
Remarks
It uses a configurable origin and direction, along with end point data from the Curve Data Provider, to generate a bezier curve that masks discrepancies between divergent origins, and mask any stabilization applied.
Properties
baseLineMaterial
Material to use in all cases other than when over 3D geometry that is not a valid interactable target.
Declaration
public Material baseLineMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
computeMidPointWithComplexCurves
Determines if the mid-point is computed for curves with more than 1 segment. Useful to maintain a good shape with projectile curves. Overwrites any line bend ratio settings when active.
Declaration
public bool computeMidPointWithComplexCurves { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
curveEndOffset
Offset at the end of the curve in meters to avoid overlap with the target. Set to 0 to disable.
Declaration
public float curveEndOffset { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
curveInteractionDataProvider
Curve data source used to generate the visual curve.
Declaration
public ICurveInteractionDataProvider curveInteractionDataProvider { get; set; }
Property Value
| Type | Description |
|---|---|
| ICurveInteractionDataProvider |
curveStartOffset
Offset at the start of the curve to avoid overlap with the origin. Set to 0 to disable.
Declaration
public float curveStartOffset { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
customizeLinePropertiesForState
Indicates whether to customize line properties for different endpoint type states.
Declaration
public bool customizeLinePropertiesForState { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
emptyHitMaterial
Material to use when over 3D geometry that is not a valid interactable target.
Declaration
public Material emptyHitMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
endPointExpansionRate
Rate at which the end point expands and retracts to and from the end point.
Declaration
public float endPointExpansionRate { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
extendLineToEmptyHit
Determines if the line should extend out to empty hits, if not, length will be maintained.
Declaration
public bool extendLineToEmptyHit { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
extensionRate
Rate at which the line extends. Set to 0 for instant extension.
Declaration
public float extensionRate { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
hoverHitProperties
Line properties when a valid non-UI hit is detected.
Declaration
public LineProperties hoverHitProperties { get; set; }
Property Value
| Type | Description |
|---|---|
| LineProperties |
lineDynamicsMode
Specifies the dynamics mode of the line.
Declaration
public LineDynamicsMode lineDynamicsMode { get; set; }
Property Value
| Type | Description |
|---|---|
| LineDynamicsMode |
lineOriginTransform
The transform that determines the origin position and direction of the line when overriding.
Declaration
public Transform lineOriginTransform { get; set; }
Property Value
| Type | Description |
|---|---|
| Transform |
linePropertyAnimationSpeed
Speed at which the line properties animate when transitioning between states. Set to 0 for instant transitions.
Declaration
public float linePropertyAnimationSpeed { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
lineRenderer
"Line renderer to control."
Declaration
public LineRenderer lineRenderer { get; set; }
Property Value
| Type | Description |
|---|---|
| LineRenderer |
maxVisualCurveDistance
Maximum distance the visual curve can extend.
Declaration
public float maxVisualCurveDistance { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
noValidHitProperties
Line properties when no hit is detected or when over an object that cannot be interacted with.
Declaration
public LineProperties noValidHitProperties { get; set; }
Property Value
| Type | Description |
|---|---|
| LineProperties |
overrideLineOrigin
Indicates whether to override the line origin with a custom transform. If no lineOriginTransform is set and this is true, this transform will be used.
Declaration
public bool overrideLineOrigin { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
renderLineInWorldSpace
If true the line will be rendered in world space, otherwise it will be rendered in local space. Set this to false in the event that high speed locomotion causes some visual artifacts with the line renderer.
Declaration
public bool renderLineInWorldSpace { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
restingVisualLineLength
Default length of the line when not extended or retracted.
Declaration
public float restingVisualLineLength { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
retractDelay
Delay before the line starts retracting after extending.
Declaration
public float retractDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
retractDuration
Duration it takes for the line to fully retract.
Declaration
public float retractDuration { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
selectHitProperties
Line properties when a valid selection is detected.
Declaration
public LineProperties selectHitProperties { get; set; }
Property Value
| Type | Description |
|---|---|
| LineProperties |
snapToSelectedAttachIfAvailable
Snaps the line to a selected attachment point if available.
Declaration
public bool snapToSelectedAttachIfAvailable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
snapToSnapVolumeIfAvailable
Snaps the line to a snap volume if available.
Declaration
public bool snapToSnapVolumeIfAvailable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
swapMaterials
Indicates whether to swap the Line Renderer component's material for different states.
Declaration
public bool swapMaterials { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
uiHitProperties
Line properties when a valid UI hit is detected.
Declaration
public LineProperties uiHitProperties { get; set; }
Property Value
| Type | Description |
|---|---|
| LineProperties |
uiPressHitProperties
Line properties when a valid UI press hit is detected.
Declaration
public LineProperties uiPressHitProperties { get; set; }
Property Value
| Type | Description |
|---|---|
| LineProperties |
visualPointCount
Number of points used to create the visual curve.
Declaration
public int visualPointCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Awake()
See MonoBehaviour.
Declaration
protected void Awake()
LateUpdate()
See MonoBehaviour.
Declaration
protected void LateUpdate()
OnDestroy()
See MonoBehaviour.
Declaration
protected void OnDestroy()