Class ArmModel
Assembly: UnityEngine.XR.LegacyInputHelpers.dll
public class ArmModel : BasePoseProvider
Fields
Declaration
protected static readonly Vector3 DEFAULT_ARM_EXTENSION_OFFSET
Field Value
Declaration
protected static readonly Vector3 DEFAULT_CONTROLLER_REST_POSITION
Field Value
Declaration
protected const float DEFAULT_ELBOW_BEND_RATIO = 0.6
Field Value
Declaration
protected static readonly Vector3 DEFAULT_ELBOW_REST_POSITION
Field Value
Declaration
protected static readonly Vector3 DEFAULT_WRIST_REST_POSITION
Field Value
Declaration
protected const float EXTENSION_WEIGHT = 0.4
Field Value
Declaration
protected const float MAX_EXTENSION_ANGLE = 60
Field Value
Declaration
protected const float MIN_EXTENSION_ANGLE = 7
Field Value
Declaration
protected static readonly Vector3 NECK_OFFSET
Field Value
Declaration
protected static readonly Vector3 SHOULDER_POSITION
Field Value
Declaration
protected Vector3 m_ControllerPosition
Field Value
Declaration
protected Quaternion m_ControllerRotation
Field Value
Declaration
protected Vector3 m_ElbowPosition
Field Value
Declaration
protected Quaternion m_ElbowRotation
Field Value
Declaration
protected Vector3 m_HandedMultiplier
Field Value
Declaration
protected Vector3 m_NeckPosition
Field Value
Declaration
protected Vector3 m_TorsoDirection
Field Value
Declaration
protected Quaternion m_TorsoRotation
Field Value
Declaration
protected Vector3 m_WristPosition
Field Value
Declaration
protected Quaternion m_WristRotation
Field Value
Properties
Offset applied to the elbow position as the controller is rotated upwards.
Declaration
public Vector3 armExtensionOffset { get; set; }
Property Value
Declaration
public Vector3 controllerPosition { get; }
Property Value
Position of the controller joint relative to the wrist before the arm model is applied.
Declaration
public Vector3 controllerRestPosition { get; set; }
Property Value
Declaration
public Quaternion controllerRotation { get; }
Property Value
Ratio of the controller's rotation to apply to the rotation of the elbow.
The remaining rotation is applied to the wrist's rotation.
Declaration
public float elbowBendRatio { get; set; }
Property Value
Declaration
public Vector3 elbowPosition { get; }
Property Value
Position of the elbow joint relative to the head before the arm model is applied.
Declaration
public Vector3 elbowRestPosition { get; set; }
Property Value
Declaration
public Quaternion elbowRotation { get; }
Property Value
the pose which represents the final tracking result of the arm model
Declaration
public Pose finalPose { get; set; }
Property Value
The game object which represents the "head" position of the user
Declaration
public XRNode headGameObject { get; set; }
Property Value
If true, the root of the pose is locked to the local position of the player's neck.
Declaration
public bool isLockedToNeck { get; set; }
Property Value
Declaration
public Vector3 neckPosition { get; }
Property Value
the pose to use as the input 3DOF position
Declaration
public XRNode poseSource { get; set; }
Property Value
Declaration
public Vector3 shoulderPosition { get; }
Property Value
Declaration
public Quaternion shoulderRotation { get; }
Property Value
Declaration
public Vector3 torsoDirection { get; }
Property Value
Declaration
public Quaternion torsoRotation { get; }
Property Value
Declaration
public Vector3 wristPosition { get; }
Property Value
Position of the wrist joint relative to the elbow before the arm model is applied.
Declaration
public Vector3 wristRestPosition { get; set; }
Property Value
Declaration
public Quaternion wristRotation { get; }
Property Value
Methods
Declaration
protected virtual bool ApplyArmModel()
Returns
Declaration
protected virtual void ApplyExtensionOffset(float extensionRatio)
Parameters
Type |
Name |
Description |
float |
extensionRatio |
|
Declaration
protected virtual bool ApplyInverseNeckModel(Vector3 headPosition, out Vector3 calculatedPosition)
Parameters
Returns
Declaration
protected virtual void ApplyRotationToJoints()
Declaration
protected virtual float CalculateExtensionRatio(float xAngle)
Parameters
Type |
Name |
Description |
float |
xAngle |
|
Returns
Declaration
protected virtual void CalculateFinalJointRotations(Quaternion controllerOrientation, Quaternion xyRotation, Quaternion lerpRotation)
Parameters
Declaration
protected virtual Quaternion CalculateLerpRotation(Quaternion xyRotation, float extensionRatio)
Parameters
Returns
Declaration
protected bool GetControllerRotation(out Quaternion rotation, out Quaternion xyRotation, out float xAngle)
Parameters
Returns
Gets the Pose value from the calculated arm model. as the model returns both position and rotation in all cases, we set both flags on return if successful.
Declaration
public override PoseDataFlags GetPoseFromProvider(out Pose output)
Parameters
Type |
Name |
Description |
Pose |
output |
|
Returns
Overrides
Declaration
public virtual bool OnControllerInputUpdated()
Returns
Declaration
protected virtual void OnDisable()
Editor only API to draw debug gizmos to help visualize the arm model
Declaration
public virtual void OnDrawGizmos()
Declaration
protected virtual void OnEnable()
Declaration
protected virtual void SetUntransformedJointPositions()
Declaration
protected bool TryGetAngularAcceleration(XRNode node, out Vector3 angularAccel)
Parameters
Returns
Declaration
protected bool TryGetAngularVelocity(XRNode node, out Vector3 angVel)
Parameters
Returns
Declaration
protected bool TryGetForwardVector(XRNode node, out Vector3 forward)
Parameters
Returns
Declaration
protected bool TryGetPosition(XRNode node, out Vector3 position)
Parameters
Returns
Declaration
protected bool TryGetRotation(XRNode node, out Quaternion rotation)
Parameters
Returns
Declaration
protected virtual void UpdateHandedness()
Declaration
protected virtual bool UpdateNeckPosition()
Returns
Declaration
protected virtual bool UpdateTorsoDirection(bool forceImmediate)
Parameters
Type |
Name |
Description |
bool |
forceImmediate |
|
Returns
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.