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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

(Solved!) vector3.distance(target.transform.position, this.transform.position) giving weird values

Discussion in 'Physics' started by Done4Good, May 28, 2015.

  1. Done4Good

    Done4Good

    Joined:
    Mar 27, 2015
    Posts:
    9
    does anyone experience the same with this? can somebody help me with this?


    i tried debugging the outputs and it game me the following values


    target: (-13.3, -34.9, -2.3)
    this: (-13.3, 0.1, -2.8)

    pos: 35.01188

    pos soul'd have 0.something value, yet it gives me that 35.something
     
  2. Done4Good

    Done4Good

    Joined:
    Mar 27, 2015
    Posts:
    9
    ok i saw the problem, it's right in front of me. the Y value of the target keeps on increasing. Although no changes happening on the game objects.. i don't know whats causing the behaviours but i solved it by deleting the game object of the target and changed it.