-
lemon juice hurts your eyes
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!
-
[Bumping this thread over to Math & Physics]
Take a look at this thread, might be closer to what you're trying to do.
-
lemon juice hurts your eyes
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!
-
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.
-
Senior Member
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.
-
lemon juice hurts your eyes
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|