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.

transform.position vs. transform.localPosition

Discussion in 'ML-Agents' started by AndrewGri, Apr 4, 2020.

  1. AndrewGri


    Jan 30, 2020
    Most probably this is very silly question.
    When I look into ML Agents examples I see that agent scripts use transform.position when resetting agent.
    But when I do that after making clones of my arena I get all agents only on one arena. To fix that I use transform.localPosition. I also use transform.localPosition in agent observations.
    But how ML Agents examples work then, because they also use arena cloning?
    Last edited: Apr 4, 2020
  2. awjuliani


    Unity Technologies

    Mar 1, 2017
    Hi AndrewGri,

    We use localPosition for observations because we care about ensuring that the agent "sees" the world relative some semantically meaningful center point. In Unity localPosition corresponds to the position of the parent object, in this case the Arena. Position on the other hand is the global position.