Transform Mover
An event-driven utility component that translates an object along a single locked local axis. It clamps movement to a specific distance range and supports waypoint events.
Like the Hinge Rotator, this is a mechanical driver. Attach it alongside an Interactable and wire the interactable's output events to the mover's public methods to create sliding doors, drawers, physical buttons, and moving platforms.
Editor Interface
Configuration Variables
Target & Range
Toggle Dynamics (On / Off)
Drag Dynamics (Continuous Input)
Gizmos & Path Events
Editor Gizmos & Previewing
Like the Rotator, the TransformMover provides instant visual feedback via a custom Scene View gizmo.
At the bottom of the inspector, dragging the Preview Position (0-1) slider physically translates the model along its designated axis in your Scene view. A magenta track line connects the Closed and Open ghost previews so you can perfectly align a sliding drawer with a desk frame before hitting Play. If you configure Position Path Events, they will visually appear as markers directly on the movement track.
Wiring Up Interaction Types
Because this is a pure mechanical utility, you must wire the core Interactable events to this script's public methods.
Toggle (Sliding Doors, Hatches)
For an object that slides between two extremes:
- Set the Interactable type to Toggle.
- Wire
OnToggleOntoTransformMover.MoveToOpen(). - Wire
OnToggleOfftoTransformMover.MoveToClose().
Drag (Drawers, Heavy Sliding Gates)
For an object the player must hold and pull:
- Set the Interactable type to Drag.
- Wire
OnDragDeltatoTransformMover.MoveByDragDelta(Vector2). The Unity Event signatures match perfectly. - Set your Drag Mouse Axis to
Mouse Yfor pulling motions, orMouse Xfor horizontal sliding.
Push/Pull (Physical Slider Bars, Throttles)
For an object whose position maps 1:1 with an input value:
- Set the Interactable type to Push/Pull (and set its min/max to
0and1). - Wire
OnValueChangedtoTransformMover.SetPosition01(float). The slider will physically track the float value across its definedOpen Distance.
The Zero Reference System
During Awake(), or when Sync Zero Ref is clicked in the Inspector, the Mover captures its current local position and permanently freezes it as the "0.0 Closed" state. The Open Distance is measured entirely relative to this starting point.
If you reposition your desk prefab in the world, the drawers will not break; the zero-reference ensures they always slide perfectly relative to their parent frame.