Immerse

Door

A synchronised interactable door that uses physics to push

Description

A Door is a component that can be opened and closed using physics (comprising a hinge and door handle component), and is synchronised between all users in a session.

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

How it works

Door uses physics (a Rigidbody , HingeJoint and a Collider ) to enable interaction. When a VR user's hand comes in close proximity to the door handle, they can pull the trigger on the controller to start interaction. The hand will disappear, but when they move the controller, the door 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.

Door 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.Door

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 axes 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 a new child GameObject
  • Position this child to be where the door handle should be
  • Add Door component
  • Add a collider to the GameObject - This is used to detect the closest interactive object to the controller

🚧

Common Issues

If the door 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.
  • Is 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? Is the door collider going through any other scene geometry like the floor?
  • 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 TransformSymc that Dial is attached to.
If this is not set (default), then the SDK will look for the TransformSync on the same object.
Requires Two handsOnly after a second hand is engaged will the door move.
Requires Two hands for unsnappingOnly after a second hand is engaged will the door unsnap.
Is Kinematic After EngageTrue if physics should be switched on after the player let go of the door.
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 door moves.
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 Door Example

Learn more about the Examples project

Updated 4 months ago


Door


A synchronised interactable door that uses physics to push

Suggested Edits are limited on API Reference Pages

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