Search Unity

Adjusting speed through rotation

Discussion in 'Scripting' started by Just451, May 28, 2017.

  1. Just451

    Just451

    Joined:
    May 28, 2017
    Posts:
    2
    Hello community,

    I would like to make it so my object's speed is dependent on its X rotation.
    For example: Its default speed is 10.
    When tilting up, giving it a X rotation of -40, the speed should go down to 4
    When tilting down, giving it a X rotation of 40, the speed should go up to 16.
    I've been trying all kinds of ways, but I can't seem to get it working.
    I hope someone can give me some directions!

    Thanks!
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Post the code you've tried and you'll probably get some feedback, comments & suggestions.

    Please use code tags (there's a button in the reply section "Insert -> Code" and a pinned thread in the forums, for more details). :)