0

In My Application I Have One Arrow Image With Fix Center and i Can rotate it by touch move method on same center but i also need to Toss/trow the arrow after doing some rotation with dragging or without doing that How Can I Put The Toss/Throw Action in MyApplication

Thank You Very Much In/ advance

NIKHIL
  • 117
  • 9

1 Answers1

1

Not sure about your specific application, but in general it would work like this.

float startPos = /* touchStart */;
float endPos = /* touchEnd */
float angle = atan2f(startpos.y - endpos.y, startpos.x - endpos.x);
float force = 10;

float velocityX = cosf(angle) * force;
float velocityY = sinf(angle) * force;

/** Move object every frame using velocityX / velocityY **/ 
onedayitwillmake
  • 1,203
  • 1
  • 11
  • 22