# Figuring out force required to get an object from A to B

1. Oct 13, 2015

### newcomma

I'm trying to work out as part of video game how to do the following:

• I have an object A with a current 3D position and velocity
• I have a target B with a different position and velocity
• I need to match the position and velocity within a target time T

I want to calculate how to get from A to B within T, or I guess what force I should be adding at each time step. I took a look at a similar question

https://www.physicsforums.com/threa...e-an-object-from-one-point-to-another.327804/
F(t)=−k∗(x(t)−xmouse(t))−c∗v(t)

The undefined symbols are:
xmouse(t)=
position of the mouse at time t
k = "Spring" constant, force of attraction between object and mouse
c = "Viscous damping coefficient", force that slows the object down​

And whilst the damping formula provided here allows nice smooth motion for an object to reach the other, I'm unsure how to

1.) Constrain this damped formula so that I can guarantee that the object will be at the target position within a given amount of time.
2.) Match both the target position and velocity, whilst ideally still having some damping coeffecients to control how nice the curvature is.

I could calculate getting to the position in the correct time using suvat equations and constant acceleration, but this of course doesn't compensate for the velocity change either.

My physics knowledge is relatively basic, I'd appreciate any help!

Last edited: Oct 13, 2015
2. Oct 13, 2015

### CWatters

I think calculating the force is the least of your problems. This sounds difficult to me.

For example you could start by working out how long it takes the missile to reach the target based on their current relative positions... but in the time it takes to get there the target will have moved. So you need to predict where they target will be and aim for that spot. However it might take longer to get to that spot and the missile will have moved even further. I think you might need some sort of iterative process just to arrive at an aiming point.

3. Oct 13, 2015

### newcomma

Thanks for the response. So I can figure out how to get from A to B at time T using the kinematic displacement equation, or more specifically:

where V_0 and P_0 are initial velocity and initial position.

P(t) = P_0 + t*V_0 + 0.5*(t^2)*Accel

So I know after T seconds the position is P_1 (or destination position), this allows me to rearrange this kinematic equation to basically find a constant acceleration that gets A to B in time T.

If B is moving then I can keep recomputing this at each time step so it's iterative.

However the velocity it's travelling at is not the velocity I want it to end up at, which I guess requires variable acceleration somehow so I don't think this kinematic equation is useful here. Hence why I was looking at that damping equation as it smoothly gets A to B, but no time constraints.