Immerse

Dial

A synchronised interactable dial that uses physics to rotate

Description

A dial that can be rotated and can be snapped at multiple rotations, and is synchronised between multiple users in the same session.

This component uses Unity's standard HingeJoint component to restrict movement, unlike the Easy Dial. These limits are based around Unity's physics system. Physics are also used to move the dial so we can achieve a more realistic movement.

For an overview of how our SDK deals with interactions, please see Interaction Overview.

How It Works

Dial uses physics (a Rigidbody , HingeJoint and a Collider ) to enable interaction.

When a VR user's hand comes in close proximity to the dial, they can pull the trigger on the controller to initiate interaction. The hand will disappear, but when they move or rotate the controller, the dial will rotate around the configured axes. Synchronisation is achieved via messages that are sent to all users in a session. The SDK takes care of this so no need to set any of this up.

If you require your object to snap onto particular rotations (like an "on" or "off" position), please see Snapping for an overview and how to set it up.

Dial also supports reactions, which allows logic operations to be integrated on various state changes, like start of interaction, or when snapped to snap targets. See Reactions and interaction logic for more information.

📘

Immerse SDK Class Library

More detail in ImmerseSDK.Interaction.Dial

How To Implement

  1. Select a new GameObject.
  • Reset the Position, Rotation and Scale of the Object. Ensure Position is set to <0, 0, 0>
  • Add Rigidbody component
  • Add HingeJoint component
  • Edit the HingeJoint component
    • Set the Anchor to 0, 0 ,0 - it will not update correctly otherwise
    • Make sure the correct Rotation axis is selected (Unity uses a vector component to represent this. There should be a 1 on that axis component that should be used for rotation and a 0 on all the others)
    • If you want to restrict rotation (not use full 360 degrees), then tick the Use Limits box, and specify a min and max angle (in degrees). Negative angles are supported.
  • Add TransformSync component
  • Set Sync Values to Rotation
  • Add Dial component
  • Add one or more colliders to the GameObject - This is used to detect the closest interactive object to the controller

🚧

Common Issues

If the dial is not moving when you pull the trigger, check the following things:

  • Is the Hinge joint set up correctly? Check the rotation axes corresponds to the scene orientation. For instance, if the green arrow is the axes you want to rotate around, only the y component of the Rotation Axes property on Hinge Joint should have a 1 in, the x and z components should be 0.
  • Are Limits set up correctly? Check the min and max angles. For instance, -90 and 90 is a 180 degree rotation relative to the rest position set up in the scene
  • Do you have a collider on your GameObject? This is necessary for the SDK to detect engagement and for the Rigidbody to work.
    Note: When a collider is missing, you will not see the hand disappear when the trigger is pulled.
  • Do you have duplicate scene indices? You can check this on the Scene Object .
  • Do you have another collider near that might prevent movement/rotation?
  • Check if any requirements are set up, and are they all met (they should all be green when in play mode in the Editor Inspector).

Unity Editor Component

Options

PropertyDescription
Verbose Logging Enabled
When enabled, this component instance will log verbosely to the console (only in the Editor). This is useful for debugging, but can have a detrimental effect on the framerate as verbose logging sometimes logs every frame.
IndexThe object's unique index - this will be automatically set by the SDK and should not be edited.
TransformSyncReference to the TransformSync that Dial is attached to.
If this is not set (default setting), then the SDK will look for the TransformSync on the same object.
Requires Two handsOnly after a second hand is engaged will the dial move.
Requires Two hands for unsnappingOnly after a second hand is engaged will the dial unsnap.
Is Kinematic After EngageHow to treat physics after the player lets go of the object.
Interaction RequirementsA set of requirements that need to be met to allow interaction; can be used to disable the object until a particular state is reached. See Interaction Requirements for more details.
SensitivityHow easily the dial moves.
Is Large DialThis property controls what controller movements make the dial rotate.

When enabled, moving the hand in a circular motion rotates the dial. This is similar to a wheel with a handle on it.

When disabled, a wrist action moves the dial.
Invert ValueA dial's value is a floating point number between 0..1. If you use limits, then the SDK will take that into account. If you set Invert Value to true, we will map the value from 1..0 instead.
Interaction PointUsually when interaction starts, we keep movement relative to the location where the controller was. If you place a reference to a child transform in here, we will use this instead to calculate relative movement.

Unity iconTry out this component in the Examples project

Examples (menu) > Interactions > Load Dial Example

Learn more about the Examples project

Updated 4 months ago


Dial


A synchronised interactable dial that uses physics to rotate

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.