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. Dismiss Notice

Minor rotation issues?

Discussion in 'Scripting' started by pilchardDev, Mar 8, 2017.

  1. pilchardDev

    pilchardDev

    Joined:
    Aug 20, 2016
    Posts:
    40
    Hello, I'm currently using C# as a scripting base and when I change the rotation of an object, this object being the basic FPS Controller. It immediately goes back to what it was originally.

    Code (CSharp):
    1. public GameObject playerobj;
    2. playerobj.transform.eulerAngles = new Vector3(0, 50, 0);
    Any ideas? Thanks!

    ~Kind regards Lachlan.
     
  2. TrickyHandz

    TrickyHandz

    Joined:
    Jul 23, 2010
    Posts:
    196
    If you are referring to Unity's FPS controller from the Standard Assets package, the scripts used to control it are going to overwrite you changes on the next frame. The controller is designed so that the mouse position is used to drive the rotation of the object. You would need to disable the controller components that are updating the rotation to allow your change to be noticeable.
     
  3. pilchardDev

    pilchardDev

    Joined:
    Aug 20, 2016
    Posts:
    40
    Okay, Apologies I'm not too keen on changing the default setup, could you please explain how I would do this?
     
  4. TrickyHandz

    TrickyHandz

    Joined:
    Jul 23, 2010
    Posts:
    196
    That would really depend on what your actual goal is. If you could explain a bit more about what you are trying to do I can probably help more.