dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Stupid Rotation Question

  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    43

    Stupid Rotation Question

    ok i got 2 objects adn one is a missle and the other one is a base. I want the missle facing the base. How do i do it?

  2. #2
    Member
    Join Date
    May 2006
    Location
    Michigan
    Posts
    99
    you want the misel to hit the base or just to face the base based on the position like a sniper view???
    Jay

    The man with the plan !!!

  3. #3
    Member
    Join Date
    Jun 2006
    Posts
    43
    lets say i have a pointer object. i want teh pointer pointing where the mouse is.

  4. #4
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    754
    Code:
    x = base._x-missle._x;
    y = base._y-missle._y;
    ang = Math.atan2(y, x);
    missle._rotation = ang*(180/Math.PI)+90;
    missle? misel?
    Last edited by walnoot; 07-13-2006 at 06:04 PM.

  5. #5
    Member
    Join Date
    Jul 2006
    Posts
    50
    I guess this is what you were asking in my other thread... so I misunderstood you.

    Just one note:

    Code:
    missle._rotation = ang*(180/Math.PI)+90;
    Here you may want to remove that +90 at the end of the code... depending of your object... I guess walnoot is assuming your object is a vertical shape, and the missile appears from its top.
    Last edited by Neverbirth; 07-13-2006 at 06:27 PM.

  6. #6
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    754
    you're right indeed, it's just something I'm used to do.

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