Where's atan2(x,y) ?!?

damir0000damir0000 Member, BASIC Posts: 8

I didn't notice until I need it ... where's Math atan2(x,y) function? It's crucial for game development and I can't see it on the list.
Any chances to see it soon?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited December 2015

    Hi @damir0000 I doubt that'll find its way into GSC. But there's a way around it though still using the expression editor algorithms (there is atan, magnitude, vectorToangle already there). What would you want to use it for in your game?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • damir0000damir0000 Member, BASIC Posts: 8

    I need to calculate velocity after collision and atan2 is the only function capable to calc angles with respect to the quadrant the point (x, y) is in. So in order to avoid permutations (checking for positive/negative x and y) I was hoping to simply use behalf of atan2.
    Too bad...

  • tmanntmann Member Posts: 278

    @damir0000 I expect you can achieve what you want using the vectorToAngle(x,y) function

  • damir0000damir0000 Member, BASIC Posts: 8

    I've noticed vectorToAngle(x,y), what does this function return? Is it an equivalent of atan2 or something else? Does it return an angle in radians or degrees?

  • GeorgeGSGeorgeGS Member, PRO Posts: 478

    vectorToAngle(x, y) returns atan2(y, x) converted to degrees.

  • damir0000damir0000 Member, BASIC Posts: 8

    That's awesome! Thanks for making it clear!

Sign In or Register to comment.