Finding Angle

BreckenBrecken Member Posts: 143
edited December 2011 in Working with GS (Mac)
Hi
I have the attributes Touch and Release. And I have that when they swipe one actor moves in the direction game.Release is. But have can I get it to roate towards where its going. I need to find the angle between Touch And release. How do I do that?

Thanks

Comments

  • POMPOM Member Posts: 2,599
    To find an angle between two points you need to use the "vector to angle" expression .
    This is how it works :
    say you have X1, Y1 and X2 Y2
    To find the angle between them you use this:
    Make an attribute - angle - and call it "angel between 1 and 2" (or whatever name you want)
    Then:
    Change attribute "angel between 1 and 2" TO vectorToAngle(X1-X2,Y1-Y2)
    Will give you the angle between them , the value can be from 0-360

    Cheers
    Roy.
Sign In or Register to comment.