speed applyForce

Hello! 

 

I want to make a game where I can move a ball in any direction of the screen by touch and below is the code that works fine to do this, but the ball is going too fast. I want the ball to go slower but at a constant speed. I have already tried to give the ball a density but then the speed isn’t constant and then the speed depends on how far I reach my finger away from the ball. 

Some help would be great!

 

Greetings,

Hey!

Well, I don’t see any code. :stuck_out_tongue:

There are numerous methods to make objects move at a constant speed. As your title suggests using physics, I’d recommend looking into https://docs.coronalabs.com/api/type/Body/setLinearVelocity.html. Now, if the ball interacts with other objects or is affected by gravity, then the linear velocity will not remain a constant, so you’d need to keep constantly reapplying it in some runtime listener or after collisions, etc.

Without seeing your code or knowing more of what you are actually trying, it’s not feasible to provide you with any more accurate answers.

Hey!

Well, I don’t see any code. :stuck_out_tongue:

There are numerous methods to make objects move at a constant speed. As your title suggests using physics, I’d recommend looking into https://docs.coronalabs.com/api/type/Body/setLinearVelocity.html. Now, if the ball interacts with other objects or is affected by gravity, then the linear velocity will not remain a constant, so you’d need to keep constantly reapplying it in some runtime listener or after collisions, etc.

Without seeing your code or knowing more of what you are actually trying, it’s not feasible to provide you with any more accurate answers.