How to rotate a body around a point? The body has x, y, speed and angle. Coordinates of the body relative to its center. Additional conditions: point position and distance from body to point.

enter image description here

  • \$\begingroup\$ I fix the picture. Now my problem is clear? \$\endgroup\$ Commented Oct 11, 2017 at 11:27
  • \$\begingroup\$ Yes, as in "What have you tried to do to fix the issue described in the question?". \$\endgroup\$
    – Vaillancourt
    Commented Oct 11, 2017 at 11:45
  • \$\begingroup\$ Ohh, sorry. I will prepare a demo based on JS, but first I need to understand trigonometry. The problem is that I do not have knowledge in mathematics for such a simple task. Believe me, I'm not a lazy ass. \$\endgroup\$ Commented Oct 11, 2017 at 12:08
  • \$\begingroup\$ @RedYellowGreen gamedev.stackexchange.com/questions/9607/… set the position first. Then using the position and quaternions - rotate an object. Calculate direction from object to point then Quaternion.LookRotation(direction); Make sure pivot is set right for the object you are trying to rotate and its initial rotation. \$\endgroup\$ Commented Oct 11, 2017 at 12:16

1 Answer 1


First off, you have redundancy in your state.

It is enough to track:

  • angle (scalar.)
  • angular velocity (scalar.)
  • centre of rotation (2d vector.)
  • radius (scalar.)

from this you can determine:

  • the body's position (2d vector.)
  • the body's orientation (local frame defined by body-up-vector, a 2d unit vector.)

To rotate it with timestep dt, you would do:

angle += dt * angular_velocity
body.up.x = cosf( angle )
body.up.y = sinf( angle )
body.pos.x = centre.x + radius * body.up.x
body.pos.y = centre.y + radius * body.up.y

Note that instead of defining the body's rotation with an up-vector, you could use an x-vector, or even just an angle, which in your problem is the same as the angle with which the body is rotated around the centre. But when drawing your object on screen, you need a frame with two axes anyway: an x-axis and an y-axis (object's up vector.) As the axes are perpendicular it is easy to derive the x-axis from the y-axis by simply swapping the components.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .