Joystick input class.
More...
Inherits MoreMountains.Tools.MMMonoBehaviour, IDragHandler, IEndDragHandler, IPointerDownHandler, and IPointerUpHandler.
Inherited by MoreMountains.Tools.MMTouchFollowerJoystick, and MoreMountains.Tools.MMTouchRepositionableJoystick.
|
virtual void | Start () |
| On Start we initialize our stick More...
|
|
virtual void | Update () |
| On Update we check for an orientation change if needed, and send our input values. More...
|
|
virtual void | HandleOpacity () |
| Changes or interpolates the opacity of the knob More...
|
|
virtual void | RotateIndicator () |
| Rotates an indicator to match the rotation of the stick More...
|
|
virtual void | ClampToBounds () |
| Clamps the stick to the specified range More...
|
|
virtual Vector3 | ConvertToWorld (Vector3 position) |
| Converts a position to world position More...
|
|
virtual float | EvaluateInputValue (float vectorPosition) |
| We compute the axis value from the interval between neutral position, current stick position (vectorPosition) and max range More...
|
|
virtual void | OnEnable () |
| On enable, we initialize our stick More...
|
|
Joystick input class.
In charge of the behaviour of the joystick mobile touch input. Bind its actions from the inspector Handles mouse and multi touch
◆ MaxRangeModes
Enumerator |
---|
Distance | |
DistanceToTransform | |
◆ ClampToBounds()
virtual void MoreMountains.Tools.MMTouchJoystick.ClampToBounds |
( |
| ) |
|
|
protectedvirtual |
◆ ConvertToWorld()
virtual Vector3 MoreMountains.Tools.MMTouchJoystick.ConvertToWorld |
( |
Vector3 |
position | ) |
|
|
protectedvirtual |
Converts a position to world position
- Parameters
-
- Returns
◆ EvaluateInputValue()
virtual float MoreMountains.Tools.MMTouchJoystick.EvaluateInputValue |
( |
float |
vectorPosition | ) |
|
|
protectedvirtual |
We compute the axis value from the interval between neutral position, current stick position (vectorPosition) and max range
- Returns
- The axis value, a float between -1 and 1
- Parameters
-
vectorPosition | stick position. |
◆ HandleOpacity()
virtual void MoreMountains.Tools.MMTouchJoystick.HandleOpacity |
( |
| ) |
|
|
protectedvirtual |
Changes or interpolates the opacity of the knob
◆ Initialize()
virtual void MoreMountains.Tools.MMTouchJoystick.Initialize |
( |
| ) |
|
|
virtual |
◆ OnDrag()
virtual void MoreMountains.Tools.MMTouchJoystick.OnDrag |
( |
PointerEventData |
eventData | ) |
|
|
virtual |
◆ OnEnable()
virtual void MoreMountains.Tools.MMTouchJoystick.OnEnable |
( |
| ) |
|
|
protectedvirtual |
On enable, we initialize our stick
◆ OnEndDrag()
virtual void MoreMountains.Tools.MMTouchJoystick.OnEndDrag |
( |
PointerEventData |
eventData | ) |
|
|
virtual |
What happens when the stick stops being dragged
◆ OnPointerDown()
virtual void MoreMountains.Tools.MMTouchJoystick.OnPointerDown |
( |
PointerEventData |
data | ) |
|
|
virtual |
◆ OnPointerUp()
virtual void MoreMountains.Tools.MMTouchJoystick.OnPointerUp |
( |
PointerEventData |
data | ) |
|
|
virtual |
◆ RefreshMaxRangeDistance()
virtual void MoreMountains.Tools.MMTouchJoystick.RefreshMaxRangeDistance |
( |
| ) |
|
|
virtual |
This method is used to compute the max range distance when in DistanceToTransform mode
◆ ResetJoystick()
virtual void MoreMountains.Tools.MMTouchJoystick.ResetJoystick |
( |
| ) |
|
|
virtual |
Resets the stick's position and values
◆ RotateIndicator()
virtual void MoreMountains.Tools.MMTouchJoystick.RotateIndicator |
( |
| ) |
|
|
protectedvirtual |
Rotates an indicator to match the rotation of the stick
◆ SetKnobTransform()
virtual void MoreMountains.Tools.MMTouchJoystick.SetKnobTransform |
( |
Transform |
newTransform | ) |
|
|
virtual |
Assigns a new transform as the joystick knob
- Parameters
-
◆ SetNeutralPosition() [1/2]
virtual void MoreMountains.Tools.MMTouchJoystick.SetNeutralPosition |
( |
| ) |
|
|
virtual |
Sets the neutral position of the joystick
◆ SetNeutralPosition() [2/2]
virtual void MoreMountains.Tools.MMTouchJoystick.SetNeutralPosition |
( |
Vector3 |
newPosition | ) |
|
|
virtual |
◆ Start()
virtual void MoreMountains.Tools.MMTouchJoystick.Start |
( |
| ) |
|
|
protectedvirtual |
◆ Update()
virtual void MoreMountains.Tools.MMTouchJoystick.Update |
( |
| ) |
|
|
protectedvirtual |
◆ _canvasGroup
CanvasGroup MoreMountains.Tools.MMTouchJoystick._canvasGroup |
|
protected |
◆ _initialOpacity
float MoreMountains.Tools.MMTouchJoystick._initialOpacity |
|
protected |
◆ _initialZPosition
float MoreMountains.Tools.MMTouchJoystick._initialZPosition |
|
protected |
◆ _knobTransform
Transform MoreMountains.Tools.MMTouchJoystick._knobTransform |
|
protected |
◆ _maxRangeTransformDistance
float MoreMountains.Tools.MMTouchJoystick._maxRangeTransformDistance |
|
protected |
◆ _neutralPosition
Vector2 MoreMountains.Tools.MMTouchJoystick._neutralPosition |
|
protected |
◆ _newJoystickPosition
Vector3 MoreMountains.Tools.MMTouchJoystick._newJoystickPosition |
|
protected |
◆ _newTargetPosition
Vector2 MoreMountains.Tools.MMTouchJoystick._newTargetPosition |
|
protected |
◆ _rotatingIndicatorIsNotNull
bool MoreMountains.Tools.MMTouchJoystick._rotatingIndicatorIsNotNull = false |
|
protected |
◆ _targetOpacity
float MoreMountains.Tools.MMTouchJoystick._targetOpacity |
|
protected |
◆ DrawGizmos
bool MoreMountains.Tools.MMTouchJoystick.DrawGizmos = true |
whether or not to draw gizmos associated to this stick
◆ HorizontalAxisEnabled
bool MoreMountains.Tools.MMTouchJoystick.HorizontalAxisEnabled = true |
Is horizontal axis allowed.
◆ InterpolateOpacity
bool MoreMountains.Tools.MMTouchJoystick.InterpolateOpacity = true |
whether or not to interpolate opacity changes on the knob's canvas group
◆ InterpolateOpacitySpeed
float MoreMountains.Tools.MMTouchJoystick.InterpolateOpacitySpeed = 1f |
the speed at which to interpolate opacity
◆ JoystickMagnitudeValue
◆ JoystickNormalizedValue
JoystickEvent MoreMountains.Tools.MMTouchJoystick.JoystickNormalizedValue |
An event to use the normalized value of the joystick.
◆ JoystickValue
An event to use the raw value of the joystick.
◆ Magnitude
float MoreMountains.Tools.MMTouchJoystick.Magnitude |
the magnitude of the stick's vector
◆ MaxRange
float MoreMountains.Tools.MMTouchJoystick.MaxRange = 1.5f |
The MaxRange is the maximum distance from its initial center position you can drag the joystick to.
◆ MaxRangeMode
the mode in which to compute the range. Distance will be a flat value, DistanceToTransform will be a distance to a transform you can move around and potentially resize as you wish for various resolutions
◆ MaxRangeTransform
Transform MoreMountains.Tools.MMTouchJoystick.MaxRangeTransform |
in DistanceToTransform mode, the object whose distance to the center will be used to compute the max range. Note that this is computed once, at init. Call RefreshMaxRangeDistance() to recompute it.
◆ NormalizedValue
Vector2 MoreMountains.Tools.MMTouchJoystick.NormalizedValue |
the normalized value of the joystick
◆ OnDragEvent
UnityEvent MoreMountains.Tools.MMTouchJoystick.OnDragEvent |
An event triggered when dragging the stick.
◆ OnPointerDownEvent
UnityEvent MoreMountains.Tools.MMTouchJoystick.OnPointerDownEvent |
An event triggered when tapping the joystick for the first time.
◆ OnPointerUpEvent
UnityEvent MoreMountains.Tools.MMTouchJoystick.OnPointerUpEvent |
An event triggered when releasing the stick.
◆ PressedOpacity
float MoreMountains.Tools.MMTouchJoystick.PressedOpacity = 0.5f |
the new opacity to apply to the canvas group when the button is pressed
◆ RawValue
Vector2 MoreMountains.Tools.MMTouchJoystick.RawValue |
the raw value of the joystick, from 0 to 1 on each axis
◆ RotatingIndicator
Transform MoreMountains.Tools.MMTouchJoystick.RotatingIndicator |
an object you can rotate to show the direction of the joystick. Will only be visible if the movement is above a threshold
◆ RotatingIndicatorThreshold
float MoreMountains.Tools.MMTouchJoystick.RotatingIndicatorThreshold = 0.1f |
the threshold above which the rotating indicator will appear
◆ TargetCamera
Camera MoreMountains.Tools.MMTouchJoystick.TargetCamera |
The camera to use as the reference for any ScreenToWorldPoint computations.
◆ VerticalAxisEnabled
bool MoreMountains.Tools.MMTouchJoystick.VerticalAxisEnabled = true |
Is vertical axis allowed.
◆ ComputedMaxRange
float? MoreMountains.Tools.MMTouchJoystick.ComputedMaxRange |
|
get |
◆ ParentCanvasRenderMode
RenderMode MoreMountains.Tools.MMTouchJoystick.ParentCanvasRenderMode |
|
getprotected set |
the render mode of the parent canvas this stick is on
The documentation for this class was generated from the following file:
- E:/Github/Store/NiceTouchStore/Assets/NiceTouch/Common/Scripts/MMTools/MMControls/MMTouchJoystick.cs