Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Pulling on a bow. In the third image, the arrow is not centred.

I am trying to create a bow and arrow animation in which the player can drag downwards to increase the bow strength (see the image) and release it to hit a target. I can't get the arrow to align with the bow when the arrow's height is changed (third image). I am rotating both the bow and arrow around their respective origins (w/2, h/2).

What is the correct way to do it?

share|improve this question
you should rotate the arrow around the bows origin. Basically you would be parenting the arrow to the bow (so all bow movement and rotation would get propagated to the arrow). – Benjamin Danger Johnson Apr 24 '13 at 18:51
up vote 4 down vote accepted

Since the arrow is rotating around a center point (the same point of the bow), when you draw back on the bow, you need to keep the center point at the same point as the bow, but move the arrow back across it.

That way, you're rotating both the bow and arrow around the same point.

share|improve this answer
i am rotating both bow and arrow at the same point but when i move the arrow back, the centre point of arrow changes naturally. – PraveenMax Apr 24 '13 at 17:26
When you move the arrow back, you have to keep the centre point of the arrow the same as the centre point of the bow. This means they are still rotating around the same point, and are at the same place as well, assuming you're drawing where the centre point/origin is. – Chris Beamond Apr 25 '13 at 2:21
When i keep the centre of both arrow and bow same, at one point the arrow starts to rotate slower since its new center will be farther than the its older point.hence error occurs as shown in image 3. – PraveenMax Apr 30 '13 at 7:19

If the arrow is of different dimensions than the bow the point which it should rotate around should not be its own center but rather the around the same point of rotation the bow rotates around, which might very well be outside the image of the arrow.

share|improve this answer
Or to put it another way: There are two parameters to rotation: A point and an angle. If your bow and arrow are supposed to rotate together, make sure they're rotating by the same angle around the same point. – Anko Apr 24 '13 at 11:26
@Anko It works only when the arrow is not being moved vertically. – PraveenMax Apr 24 '13 at 13:09
The movement of the arrow should always be perpendicular to the direction of the length of the bow. Hence you should only be moving the arrow vertically when the bow is horizontal. Are you doing that and keeping their points of rotation the same? – Anko Apr 24 '13 at 20:48
the arrow works well when the bow is perfectly horizontal. But when the bow is tilted to either right or left(see 3rd image), they get misaligned. Both are rotated at the same point but arrow's centre will never be the same since it needs to move vertically. – PraveenMax Apr 30 '13 at 7:17

Try setting up a rotation matrix for both sprites.

Rotation matrix - Wikipedia

Set the point to where you want to rotate. Although to make it an easier point of reference, I would rotate at the point where the bow crosses the arrow.

If i knew what language you're programming in I could look up more information to help. If you haven't worked with matrices yet, do a search for the language you're using and graphics matrix. Eg "c# graphics matrix".

share|improve this answer
its libgdx which is java.i never used matrix – PraveenMax Apr 30 '13 at 7:20 Leads you in the direction of matrix manipulation for libgdx. A rich article can be found here – Kaz Duston McGown May 15 '13 at 6:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.