# How do I calculate logical velocity / direction?

I have a simple jBox2D (Java) implementation of a world with couple of Circle bodies that at the begining are static.

I want to make them movable when the user touches the circle. But I want them to be movable from the point where it's touched to its logical velocity direction.

How do I set the velocity / direction of the body after the touch so that it moves to the point that is logical to the touch?

10x

• Define "logical" a bit more clearly. Do you simply want to apply a force from where you click to the center of the circle? (That way, on an even plane, if you click just a bit to the right of the center of the circle, it will start rolling slowly, if you click on its edge it will roll faster)? Sep 13, 2011 at 10:21
• yes I want to apply force when a point is touched and make it move to some path.. Sep 13, 2011 at 10:25
• are we talking about easying? to move tour object to the clicked point using a smooth transition? Sep 13, 2011 at 11:22
• no - let's look at this this way: how can I make a body move to a specified position on the screen? Sep 13, 2011 at 11:38

If you simply want it to move toward your finger and stop there, you need to call setAngularImpulse() using the vector between your finger location in world space (needs translation from screen space) and the world space location of the object itself. Once it gets near (see note) to your finger, begin slowing it down, or else just set it's velocity to zero.