Rotate body around a point

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Matkins
Citizen
Posts: 53
Joined: Mon Mar 23, 2009 5:12 pm

Rotate body around a point

Post by Matkins »

Can i specify a point to rotate a body around in real time or can i only rotate it around its local 0,0 point?
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: Rotate body around a point

Post by Kaze »

Use trig.
Matkins
Citizen
Posts: 53
Joined: Mon Mar 23, 2009 5:12 pm

Re: Rotate body around a point

Post by Matkins »

Trig is all very nice but the setAngle() function only takes one argument, the angle. How can I rotate a body around a point other than local 0,0?

The only way i can see to do this is to destroy all the shapes on the body, recreate the shapes in the position that coresponds to where i want to rotate, and then shift the body in the opposite direction to how i effectively shifted the shapes. That feels like a total bodge, is there a better way?
Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests