قالب وردپرس قالب وردپرس قالب فروشگاهی وردپرس وردپرس آموزش وردپرس

Using Rigidbody.MovePosition vs transform.position in Unity

Unity Continuous vs Discrete Collision Detection: How to Prevent Tunneling
February 22, 2026
How Physics.autoSyncTransforms Works in Unity
How Physics.autoSyncTransforms Works in Unity
February 23, 2026

Using Rigidbody.MovePosition vs transform.position in Unity

Using Rigidbody.MovePosition vs transform.position in Unity

Moving objects in Unity seems simple at first. You change the position and the object moves. But when physics is involved, choosing the wrong method can cause jitter, missed collisions, or completely broken interactions.

One of the most common mistakes is moving a Rigidbody using transform.position instead of Rigidbody.MovePosition. Let’s break down the difference and when you should use each one.

The Core Difference

transform.position directly teleports the object to a new position. It bypasses the physics system.

Rigidbody.MovePosition moves the object through the physics engine, respecting interpolation and collision detection.

If your object has a Rigidbody attached and interacts with physics, this distinction is critical.

Using transform.position

This method instantly sets the object’s world position.

transform.position = new Vector3(0, 5, 0);

This works fine for:

  • Objects without Rigidbody
  • UI elements
  • Teleportation mechanics
  • Static scene setup

But if the object has a non-kinematic Rigidbody, this can:

  • Break collision detection
  • Cause physics jitter
  • Ignore interpolation
  • Create tunneling issues

You are essentially overriding physics.

Using Rigidbody.MovePosition

This method tells Unity’s physics engine to move the Rigidbody during the next physics step.

Rigidbody rb;

void Start()
{
    rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    Vector3 targetPosition = rb.position + Vector3.forward * 5f * Time.fixedDeltaTime;
    rb.MovePosition(targetPosition);
}

Important: MovePosition should be called inside FixedUpdate, not Update.

This method:

  • Respects interpolation
  • Works correctly with collision detection
  • Maintains smooth physics behavior
  • Prevents jitter

When Should You Use MovePosition?

Use MovePosition when:

  • The object has a Rigidbody
  • You want smooth physics-based movement
  • The object must collide properly
  • You are controlling a kinematic Rigidbody

Kinematic Rigidbody Movement

MovePosition is especially important for kinematic Rigidbodies. These objects are controlled by script but still interact with physics.

rb.isKinematic = true;

void FixedUpdate()
{
    Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    rb.MovePosition(rb.position + movement * 5f * Time.fixedDeltaTime);
}

This gives you full control while keeping collision responses accurate.

Common Mistake: Mixing Transform and Rigidbody Movement

Never mix these two approaches on the same object. For example:

transform.position += Vector3.forward * Time.deltaTime; // Wrong

while also having a Rigidbody attached.

This leads to:

  • Collision glitches
  • Objects pushing through walls
  • Physics instability

Teleporting Properly

If you need instant teleportation for a Rigidbody, it is acceptable to set the position directly:

rb.position = new Vector3(0, 10, 0);

But use this only for true teleports, not regular movement.

Interpolation Consideration

If Rigidbody interpolation is enabled, MovePosition will appear smooth even if physics updates are less frequent.

  • Interpolation works correctly with MovePosition
  • Interpolation may appear broken when using transform.position

Quick Comparison

MethodPhysics SafeUse Case
transform.positionNoNon-physics movement, teleporting
Rigidbody.MovePositionYesPhysics-based movement

Final Thoughts

If your GameObject has a Rigidbody and participates in physics, always move it using Rigidbody methods inside FixedUpdate. Using transform.position may seem easier, but it often creates subtle bugs that are hard to diagnose later.

Think of it this way: if physics is involved, let the physics engine handle the movement.

Leave a Reply

Your email address will not be published. Required fields are marked *

Skip to toolbar