A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Angles

  1. #1

    Lightbulb

    Hello,

    I am trying to find out how to get opposite trajectory angle to a randomly flying object (ball?).

    Bascially when an object hits the wall of a movie, then I want to get the opposite angle to fire the ball back in the opposite direction.

    Thanks,

    PC

  2. #2
    Junior Member
    Join Date
    Mar 2002
    Posts
    3

    You could do this:

    keep track of the object's last known position. From this, use the built-in math functions to get your angle. The math functions return either degrees or radians, so read the documentation to find out which functions to use.

    ex:
    to calculate incident angle, use
    if hitting top wall: Math.arctan(change_in_y / change_in_x)



  3. #3
    Gross Pecululatarian Ed Mack's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    2,954

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