-1

I make one box2d game and I have some problem based on touch.

I desired one box2d body object moves on touch with speed / velocity.

I have an Ant box2d body with revolute joint and I try to move that box2d body object with touch and speed of touch. But I have no idea for that.

Ant body

enter image description here

I am also a new developer in Box2d.

please help me.... for solving this issue...

DharaParekh
  • 1,730
  • 1
  • 10
  • 17

1 Answers1

0
CGFloat velocity = ccpSub(position, previousPosition);
CGFloat speed = ccpLength(velocity);
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • You get position/previousPosition from the touch location. Velocity you can set directly on the Box2D body. – CodeSmile Oct 24 '13 at 15:43