Class Vector3Control
A floating-point 3D vector control composed of three Axis
Inherited Members
Namespace: UnityEngine .InputSystem .Controls
Assembly: Unity.InputSystem.dll
Syntax
public class Vector3Control : InputControl<Vector3>
Constructors
Vector3Control()
Declaration
public Vector3Control()
Properties
x
Declaration
public AxisControl x { get; set; }
Property Value
Type | Description |
---|---|
Axis |
y
Declaration
public AxisControl y { get; set; }
Property Value
Type | Description |
---|---|
Axis |
z
Declaration
public AxisControl z { get; set; }
Property Value
Type | Description |
---|---|
Axis |
Methods
CalculateOptimizedControlDataType()
Calculates and returns an optimized data type that can represent a control's value in memory directly.
Declaration
protected override FourCC CalculateOptimizedControlDataType()
Returns
Type | Description |
---|---|
Four |
An optimized data type that can represent a control's value in memory directly. Input |
Overrides
Remarks
The value then is cached in optimized
EvaluateMagnitude(void*)
Compute an absolute, normalized magnitude value that indicates the extent to which the control is actuated in the given state.
Declaration
public override float EvaluateMagnitude(void* statePtr)
Parameters
Type | Name | Description |
---|---|---|
void* | statePtr | State containing the control's state |
Returns
Type | Description |
---|---|
float | Amount of actuation of the control or -1 if it cannot be determined. |
Overrides
Remarks
Magnitudes do not make sense for all types of controls. For example, for a control that represents
an enumeration of values (such as Touch
Controls that have no meaningful magnitude will return -1 when calling this method. Any negative return value should be considered an invalid value.
See Also
FinishSetup()
Perform final initialization tasks after the control hierarchy has been put into place.
Declaration
protected override void FinishSetup()
Overrides
Remarks
This method can be overridden to perform control- or device-specific setup work. The most common use case is for looking up child controls and storing them in local getters.
Examples
public class MyDevice : InputDevice
{
public ButtonControl button { get; private set; }
public AxisControl axis { get; private set; }
protected override void OnFinishSetup()
{
// Cache controls in getters.
button = GetChildControl("button");
axis = GetChildControl("axis");
}
}
ReadUnprocessedValueFromState(void*)
Read value from provided statePtr
.
Declaration
public override Vector3 ReadUnprocessedValueFromState(void* statePtr)
Parameters
Type | Name | Description |
---|---|---|
void* | statePtr | State pointer to read from. |
Returns
Type | Description |
---|---|
Vector3 | The controls current value. |
Overrides
Remarks
Read value from provided statePtr
without any caching.
See Also
WriteValueIntoState(Vector3, void*)
Write a value into state at the given memory.
Declaration
public override void WriteValueIntoState(Vector3 value, void* statePtr)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | Value for the control to store in the state. |
void* | statePtr | State containing the control's state |
Overrides
Remarks
Writing values will NOT apply processors to the given value. This can mean that when reading a value from a control after it has been written to its state, the resulting value differs from what was written.
Exceptions
Type | Condition |
---|---|
Not |
The control does not support writing. This is the case, for example, that compute values (such as the magnitude of a vector). |