Finding the angle

cgalianocgaliano Member, PRO Posts: 21

Easy question for the experts, I am sure: What is the easiest way of finding the angle in which an actor is moving, relative to the scene? i.e. if the actor is moving horizontally, the angle would be 0 and if vertically it would be 90.

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    vectorToAngle( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y )%360

  • cgalianocgaliano Member, PRO Posts: 21

    Thanks @Socks ... what is the "%360" for?

  • SocksSocks London, UK.Member Posts: 12,822

    @cgaliano said:
    Thanks Socks ... what is the "%360" for?

    Oh, I just chucked that on the end to force the angles to be 0-360° rather than GameSalad's default 0-180° and then -180° to 0 (which I find a bit weird).

  • cgalianocgaliano Member, PRO Posts: 21

    great, it works. Thanks a lot!

Sign In or Register to comment.