Course contentsShow
← Unity Game Development
Lesson 47 of 8281. Unity FoundationsFree lesson

Configuring Pivot Points for Rotational Anchors

Students will adjust object pivot points to control the center of rotation and scale for complex 3D models and meshes.

Configuring Pivot Points for Rotational Anchors

In this lesson, you will learn how to shift an object’s center of rotation to create realistic hinges and mechanical movements.

The Problem: Rotation from the Center

By default, Unity calculates an object's position based on its Transform component, which is usually located at the geometric center of the mesh. If you try to rotate a door or a clock hand using this default center, the object will spin in place like a top, rather than swinging on a hinge. This happens because the pivot point is at the center of mass, not at the edge where the "anchor" should be.

The Solution: Using Empty GameObject Parents

Because a 3D model’s pivot point is baked into the asset during export, you cannot easily move it within the Unity Editor. Instead, we use the "Parenting" concept you learned in previous lessons to create a custom anchor.

  1. Create an Empty GameObject: Right-click in your Hierarchy and select Create Empty. This acts as your invisible hinge.
  2. Position the Anchor: Move this empty object to the exact spot where you want the rotation to occur (e.g., the edge of a door frame).
  3. Parent the Mesh: Drag your 3D model into the Hierarchy and make it a child of the empty GameObject.
  4. Rotate the Parent: When you rotate the empty GameObject, the child mesh will now swing around the parent's position rather than its own center.

Illustration in Code

While this is primarily a visual workflow, you can manipulate this rotation through scripts to ensure your "anchor" behaves as expected:

// Rotate the parent object (the hinge) 
// The child mesh will automatically follow the anchor
transform.Rotate(0, 90 * Time.deltaTime, 0);

By organizing your objects this way, you gain full control over complex mechanical behaviors. If you need a clock hand to sweep, simply place your anchor at the center of the clock face and parent the hand to it. The hand will then rotate perfectly around that specific point in 3D space, regardless of the hand's own mesh center.

Key Takeaway: To control complex rotations, always create an empty GameObject at the desired pivot point and make your mesh a child of that object to use it as a rotational anchor.