Driving a Door with Animator and Udon: Pivots and Pose Switching

Created: 2026-09-08Last updated: 2026-09-09

Putting a pivot at the door's edge and switching between closed and open poses with an Animator. Covers how Animation Clips and Controllers relate, why you uncheck Has Exit Time, and Udon's SetBool.

You want the door to open when a button is pressed. Not jumping instantly to a new position — opening slowly.

You could move the position bit by bit in Udon, but adjusting the opening speed and the motion in between gets painful. Repetitive fixed motion like this is easier left to Unity's animation features.

This article covers building two door poses and switching between them from Udon.

A door half open, swinging on its edge

What You'll Learn

  • Building the parent-child setup that swings a door on its edge
  • How Animation Clips and Controllers relate
  • The minimal setup for switching two poses with a Bool
  • Driving it from Udon in one line

Start from having tried methods and custom events.

Sponsored


A door swings on its edge

This is the first stumble when building a door.

Rotating the door itself spins it about the middle; a parent pivot swings it on the edge

Unity objects rotate about their center. Rotate the door Cube directly and the door's middle spins in place while both ends punch through the walls.

A real door swings on the edge with the hinges. To do the same, make an empty object the parent as the pivot.

A pivot at the door's edge, with the door as its child

The structure looks like this.

DoorPivot (empty object, placed at the door's edge)
└─ DoorPanel (the door panel, offset to the right of the parent)

Rotate DoorPivot and its child DoorPanel swings around the pivot. That gives you a door-like opening.

This "make the pivot the parent" idea works beyond doors — for anything that rotates: swaying signs, spinning fans, opening box lids.

Sponsored

Hands-On: Build an opening door

Press a button and the door opens; press again and it closes. The motion is smooth.

1. Build the pivot and the door

Create DoorPivot with "Create Empty" at (-0.8, 1, 2.8), Rotation (0, 0, 0).

Create DoorPanel as a child, from "3D Object → Cube."

FieldValue (local, relative to the parent)
Position(0.8, 0, 0)
Rotation(0, 0, 0)
Scale(1.6, 2, 0.1)

The door panel is offset 0.8m to the right of the pivot. The panel is 1.6m wide, so its left edge lands exactly at the pivot's position.

Try dragging DoorPivot's Y rotation in the Scene view. The door swings on its edge. Set it back to 0 once you've confirmed.

2. Build two poses

With DoorPivot selected, open "Window → Animation → Animation."

  1. Press "Create" and save it as DoorClosed
  2. Close it without recording anything (the Y rotation of 0 is recorded)

That's the closed pose. Build the open pose the same way.

  1. Choose "Create New Clip" from the clip name field in the Animation window and save it as DoorOpen
  2. Press the record button (the red circle)
  3. Set DoorPivot's Rotation Y to 90
  4. Stop recording

Now a Y rotation of 90 degrees is recorded.

An animation containing one pose is fine. Unity fills in the motion between them with the next setting.

3. Build the switching mechanism

Look at the Animator component automatically added to DoorPivot. The Controller field holds the Animator Controller that was just created.

Double-click to open it.

Moving between two states with a Bool parameter

Three terms come up, and their relationship is simple.

NameRole
Animation ClipOne pose or motion (DoorClosed and DoorOpen)
Animator ControllerA map of which clip plays when
Animator (the component)The part that holds that map and drives it

In the Controller window, set the following.

  1. Press + in the Parameters tab on the left, choose Bool, and name it IsOpen
  2. Right-click DoorClosed, choose "Make Transition," and draw an arrow to DoorOpen
  3. Select that arrow and add IsOpen true to Conditions
  4. Uncheck Has Exit Time
  5. Draw an arrow from DoorOpen back to DoorClosed, set Conditions to IsOpen false, and uncheck Has Exit Time there too

Unchecking Has Exit Time is the important part. Left on, the state doesn't change until the animation finishes playing. Wanting to close mid-opening means waiting for the open to complete.

Confirm that DoorClosed is the initial state (it has an orange outline). If not, right-click it and choose "Set as Layer Default State."

4. Drive it from Udon

Create DoorButton as a "3D Object → Cube" near the door.

In Assets/Scripts, choose "Create → U# Script" and make DoorSwitch.

using UdonSharp;
using UnityEngine;

[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class DoorSwitch : UdonSharpBehaviour
{
    [SerializeField] private Animator doorAnimator;

    private bool isOpen;

    public override void Interact()
    {
        if (doorAnimator == null) return;

        isOpen = !isOpen;
        doorAnimator.SetBool("IsOpen", isOpen);   // Just this
        Debug.Log("[DoorSwitch] open=" + isOpen);
    }
}

The driving logic is one line of SetBool. The opening speed and the motion in between all live on the Animator side.

The string "IsOpen" must exactly match the parameter name you made in the Controller. Case matters.

5. Confirm

Add a Udon Behaviour to DoorButton and set DoorSwitch. Drag DoorPivot into Door Animator.

Press Play and try it.

ActionExpected result
Press the buttonThe door opens smoothly
Press againIt closes
Press mid-openingIt starts closing immediately (the effect of unchecking Has Exit Time)
Walk through the doorwayYou pass through while it's open

That last check also tells you whether the door's Collider is moving. The collision rotates along with it.

Animator, or moving it directly in Udon

Either builds a door. Here's how to choose.

Animator for fixed motion, Udon for motion that varies
AnimatorDirectly in Udon
What it suitsA fixed motion you repeatMotion that varies, or is computed
Adjusting motionVisually, on a timelineBy numbers in code
CodeOne lineNeeds position math
Stopping partwayGood at itYou write it

Doors, drawers, swaying signs, machinery operating. Anything repeating the same motion is easier with an Animator.

Conversely, motion like "advances a little per press" or "faces the player's position" gets written directly in Udon.

Sponsored

Common Pitfalls

  • The door rotates about its middle → You haven't made the pivot the parent. Put an empty object at the edge and put the door under it
  • Pressing does nothing → Check that the parameter name matches, case included
  • You can't close it until it finishes opening → Has Exit Time is still checked
  • It starts openDoorClosed isn't the default state. Set it with a right-click
  • You can't pass through → The door's Collider is still in the way where it opened to. Check in the Scene view

Bonus: Good to Know Up Front

  • This is local logic: The door opens only on the presser's screen. Putting everyone in the same state needs the mechanism in a synchronized door
  • The same shape drives other things: Drawers, drawbridges, shutters, spinning signs. Only the pivot placement and the axis change
  • Adjust the opening speed on the transition: Selecting the arrow shows a timeline where you can change the switching duration. Slower for a heavy door
  • Sound makes it natural: A creak while opening goes a long way. The sound handling in toggling with a button applies
  • Different from avatar Animators: The Animator discussion in avatar customization targets something else. For moving world objects, what's in this article is enough

Summary

An Animator-driven door takes three steps.

  • Put an empty object at the door's edge and make it the parent
  • Build the closed pose and the open pose as two clips
  • Move between them with a Bool parameter. Uncheck Has Exit Time
  • From Udon, it's one line of SetBool

The question to ask before building is: "Is this motion the same every time, or does it vary?" The same means leaving it to the Animator.

To open the same door for everyone, go to a synchronized door. To close it automatically after a delay, go to calling logic after a delay.

VRChat Notes in this section63