Skip to main content

Sliding Doors & Hinge Rotators

NAMESPACEMyDreamGameStudio.InteractAnything
MENU PATHTutorials > Doors & Movers
COMPATIBILITYUnity 6.0+
DOC VERSION

This tutorial covers the core mechanical utilities of the framework. We will build a sliding sci-fi door using the Transform Mover, and a swinging physical door using the Hinge Rotator.

1. Sliding Door Setup (Transform Mover)​

  1. Bring your sliding door model into the scene. Set its layer to Interaction and add a Box Collider so player raycasts can successfully detect it.
  2. Attach the Interactable Target script to the door root and set the Interaction Type to Toggle.
  3. Attach the Transform Mover component. Assign the specific moving mesh of the door to the target field.
  4. Define your movement axis (e.g., X or Z), open distance, and slide speed. You can utilize the built-in path preview gizmo to visually verify the slide animation directly in the Scene view before hitting play.
  5. Link the On Toggle On and On Toggle Off events from the Interactable Target directly to the Mover's open and close functions.

2. Rotating Door Setup (Hinge Rotator)​

  1. Select your rotatable door object and attach the Hinge Rotator component.
  2. Define the Open and Closed angles, the rotation axis (typically Y for standard doors), and the absolute Min/Max limits.
  3. Use the visual Scene gizmo to verify the swing arc. The component natively supports both mouse drag interactions (for heavy physical pulls) and smooth toggle transitions (for automatic swinging).