CodeMonkey's Joystick Demo

bjoerdaubitbjoerdaubit Member Posts: 12
edited November -1 in Working with GS (Mac)
Hello everyone,

I am currently looking at CodeMonkey's Joystick Demo (Single Joystick) and I have understood everything more or less except for one thing. The position of the joystick is bound to the radius of the "joystick base" and this is done by a function which looks like this for example for the Y-Axis:

game.BaseY +min( game.BaseRadius , magnitude( game.Touches.Touch 1.X - game.BaseX , game.Touches.Touch 1.Y - game.BaseY ))*sin(vectorToAngle( game.Touches.Touch 1.X - game.BaseX , game.Touches.Touch 1.Y - game.BaseY ))

I understand that expression so far except the "*sin(vectorToAngle(..." Maybe someone who is familiar with this joystick my explain this function, because I don't get it ^^
Thanks!

greets

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I have found unless you are very fluent with Trigonometry. Its best just to copy paste the sin and cos functions found in templates. and just trust they will work right. :)
Sign In or Register to comment.