How to offset a direction by 180

JamesBoucherJamesBoucher Member Posts: 433
edited November -1 in Working with GS (Mac)
I'm trying to move an actor using accelerate. I store the direction in an attribute that is set with a constraint attribute that is set to self.Rotation. The self.Rotation is off by 180 degrees. How can I use the attribute (game.Direction) and offset it by 180 degrees.

Comments

  • GamexcbGamexcb Member Posts: 179
    I would just make an actor to add or subtract 180 to game.Direction

    That should work.
    I may be misunderstanding.
    -Gamexcb
  • JamesBoucherJamesBoucher Member Posts: 433
    You can't just subtract 180. If you're pointing at 110 degrees and you subtract 180 you would get 70 degrees which is not correct. It should be 290. I would like to do this with a formula.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Add 180 and mod 360.

    (#+180)%360

    But subtracting 180 in your example would make it -70 which is still counts as 290. (360-70)
  • JamesBoucherJamesBoucher Member Posts: 433
    I'll just use a rule.
  • JamesBoucherJamesBoucher Member Posts: 433
    Sorry I did not see you're post CodeMonkey. Thanks.
  • GamexcbGamexcb Member Posts: 179
    Oh yeah I am thinking of another computer language!
    Sorry!

    -Gamexcb
Sign In or Register to comment.