Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Rigidbody.MovePosition()

Discussion in 'Documentation' started by Martin_H, Jun 20, 2016.

  1. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
  2. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    The example is correct.

    While in FixedUpdate, Time.deltaTime actually returns Time.fixedDeltaTime.

    Let's say that your physics timestep is 1 tick/second, and your speed is 1 unit/tick.

    Under that scenario, every second you would move 1 unit. Now let's say you have some physics issues and want to call FixedUpdate more often, so you change your physics timestep from 1 tick/second to 2 ticks/second.

    Without using Time.deltaTime, you would now be moving 2 units/second (the function is being called 2x as much!). With Time.deltaTime you would still be moving 1 unit/second (as expected).
     
    Last edited: Jun 20, 2016
    Prodigga likes this.
  3. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    Oh, my bad! I didn't know that, thanks for explaining! It's a bit confusing for me that there are these two destinct functions that do different things in different context. I didn't even know it was possible for deltaTime to know from where it's called. Learned something new today, thanks.