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

Rotate/Pivot an Object

Discussion in 'Editor & General Support' started by Jana1108, Sep 18, 2015.

  1. Jana1108

    Jana1108

    Joined:
    Jun 27, 2015
    Posts:
    215
    Hi, in my game I am making an enemy walk across grass and then when its x position is greater than 22 then it rotates 180 degrees and goes the other way. When it does this it doesn't seem to rotate straight away, instead, it keeps moving past 22 and then rotates very slowly in a big loop. Can anyone help me in C# preferably, to stop the object from moving when it reaches 22 or greater on the x axis and rotate 180 degrees around its centre point, not a big loop! And then start walking again...
     
  2. Jana1108

    Jana1108

    Joined:
    Jun 27, 2015
    Posts:
    215
  3. Jana1108

    Jana1108

    Joined:
    Jun 27, 2015
    Posts:
    215
    Can anyone help me...?
     
  4. CStunner

    CStunner

    Joined:
    Jul 12, 2013
    Posts:
    39
    Add 180 to y axis of eulerAngle