- #1
newcomma
- 2
- 0
I'm trying to work out as part of video game how to do the following:
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/
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!
Thanks in advance.
- 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
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!
Thanks in advance.
Last edited: