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

Beginner Problem translate transform position

Discussion in 'Scripting' started by psyhova, Jun 15, 2015.

  1. psyhova

    psyhova

    Joined:
    Oct 3, 2013
    Posts:
    32
    Hell Guys I have a problem.

    I have a Character moving by script:

    transform.Translate(0,Input.GetAxis("Horizontal"),0);

    Now if I push a Button and I want to teleport to lets say: (45,23,54) World Coordinates, I use

    transform.position = Vector3(45,23,54);

    But now my Charcter Is now stuck on this position.I cant move anymore.

    So what can I do ??? Set a bool and switch it on for only one time and set him immediately back????

    Greeting for tips Ideas and solutions.
    Thanxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,384
    Post your script. (can't really tell what is happening) Use UBB code tags.
     
  3. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    less x's and the entire code would be handy :p
     
  4. psyhova

    psyhova

    Joined:
    Oct 3, 2013
    Posts:
    32
    Thank you for reply.

    The problem is solved, because it did work it was another reason.

    Thanks