A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Rotate MC around specific point

  1. #1
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546

    Rotate MC around specific point

    Hi!

    I'm making my own version of an engine like Box2D, and I've got the gravity, bouncing, dragging working, but I'd like to add some rotating when a user clicks on an object.

    Example, there's a rectangular mc on the stage and you press the upper left corner. The mc can at that point be dragged around I would like it to rotate around the point clicked.

    There's already a variable containing things like current / previous x & y position and the speed by which it is moving, so it's just the code to determine the rotating point and the degree of rotation.

    Anyone with a brain full of math that can assist me on this?
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    [Bumping this thread over to Math & Physics]

    Take a look at this thread, might be closer to what you're trying to do.

  3. #3
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    I can see it's somewhat related to the thing I'd like to accomplish, but here's an example of something almost identical, only, it's in AS2..

    http://www.ffiles.com/flash/physics_...#comments_area

    It's been such a long time since I switched to AS3 and I can hardly read AS2 anymore (to my regrets), so I can't translate it and use it for my own purpose.
    Also, the italian names for variables make it hard to understand what variables stand for
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  4. #4
    Member
    Join Date
    Mar 2009
    Posts
    60
    Maybe you could parent it to an object as a pivot which then rotates?
    That's it, I'm fed up with having my barely-legal signatures criticized.

  5. #5
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    if you have initial transformation matrix m0, you calculate new one in this order:
    m1 = m0 x translation to origin
    m2 = m1 x rotation matrix
    m3 = m2 x translation from origin
    any way, why "making my own version of an engine like Box2D" if you arent sure in these basic things? just use Box2D.
    who is this? a word of friendly advice: FFS stop using AS2

  6. #6
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    Well, I started using it, but I found it was very hard to understand due the lack of good examples..
    Also it was hard to add custom bodies to the world and then use dragging etc.

    But the most important thing is that the thing I'm working on is also rated for the code, so if I write it myself, they will probably be more generous ^^

    I'll try the parenting and matrix transformation and see which one works

    Thx in advance!
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

Tags for this Thread

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