CodeMonkey's Joystick Demo
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
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