i have to make an application in which on every click it should throw an object and that object should travel in a straight line. I am done with creating an object on every click. But how to move an object in a straight line at the time when i click. any example.
Share
At any given time
tyour object has a position(x, y). It is also moving with a velocity vector(v_x, v_y).After a change in time of
dt, if you can assume that your object is moving with constant velocity over the entire time interval, you can calculate a new position like this:If that constant velocity assumption is bad, it means you need to reduce
dtuntil it’s close enough to true.