Guides
These docs are for v3.2.0. Click to read the latest docs for v3.3.0.

VRTK_Door

extends VRTK_Control

Overview

Transforms a game object into a door with an optional handle attached to an optional frame. The direction can be freely set and also very reliably auto-detected.

There are situations when it can be very hard to automatically calculate the correct axis and anchor values for the hinge joint. If this situation is encountered then simply add the hinge joint manually and set these two values. All the rest will still be handled by the script.

The script will instantiate the required Rigidbodies, Interactable and HingeJoint components automatically in case they do not exist yet. Gizmos will indicate the direction.

Inspector Parameters

  • Direction: The axis on which the door should open.
  • Door: The game object for the door. Can also be an empty parent or left empty if the script is put onto the actual door mesh. If no colliders exist yet a collider will tried to be automatically attached to all children that expose renderers.
  • Handles: The game object for the handles. Can also be an empty parent or left empty. If empty the door can only be moved using the rigidbody mode of the controller. If no collider exists yet a compound collider made up of all children will try to be calculated but this will fail if the door is rotated. In that case a manual collider will need to be assigned.
  • Frame: The game object for the frame to which the door is attached. Should only be set if the frame will move as well to ensure that the door moves along with the frame.
  • Content: The parent game object for the door content elements.
  • Hide Content: Makes the content invisible while the door is closed.
  • Max Angle: The maximum opening angle of the door.
  • Open Inward: Can the door be pulled to open.
  • Open Outward: Can the door be pushed to open.
  • Min Snap Close: The range at which the door must be to being closed before it snaps shut. Only works if either inward or outward is selected, not both.
  • Released Friction: The amount of friction the door will have whilst swinging when it is not grabbed.
  • Grabbed Friction: The amount of friction the door will have whilst swinging when it is grabbed.
  • Handle Interactable Only: If this is checked then only the door handle is grabbale to operate the door.

Example

VRTK/Examples/025_Controls_Overview shows a selection of door types, from a normal door and trapdoor, to a door with a cat-flap in the middle.