A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: AS3 & rotation issue

Threaded View

  1. #1
    Senior Member SlimSlaby's Avatar
    Join Date
    May 2005
    Posts
    158

    AS3 & rotation issue

    I have a character that I am having follow a circle using Math.cos and Math.sin


    I also want to rotate the character so his facing is correct each frame. I am saving the last x,y location and getting the angle between it and the new location to determine the facing

    I am using this code :

    _facing = Math.atan2(last_y-loc_y,last_x -loc_x)
    rotation =( _facing / Math.PI * 180) - 180


    note -- the -180 is for offsetting the default angle of the movieclip.
    Which actually works.... EXCEPT for some reason every once in awhile that calculation completely flips my rotation for one frame?!!?

    Make sense to anyone ?
    Last edited by SlimSlaby; 01-21-2008 at 01:59 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center