0

I'm making a game that has physics. For now, I have a implemented drag and thrust (upwards acceleration):

$ a_{t+1} = a_{th} (1 - (v_t / v_T)^ 2) $ (acceleration)

$ v_{t+1} = v_t + \Delta t \space a_{t+1} $ (velocity)

$ p_{t+1} = p_t + \Delta t \space v_{t+1} $ (position)

It works well (for example, $ v_t $ will converge to $ v_T $ over time).

However, now I want to add a "soft ceiling". When the distance is large, the physics works as above. But when distance becomes smaller, a repulsive force takes over such that $ p_t $ never reaches above the ceiling.

Preferably this works for relatively high values of $ \Delta t $ and doesn't produce values of $ v_t $ higher than $ v_T $, because then the drag seems to becomes too large.

propeller
  • 103
  • Drag is proportional to the square of velocity at high speeds and is linear in velocity for lower speeds. You could implement this transition with a sigmoid function, for example something like $s(v)v+s(1-v)v^2$, where $s(v)$ goes from 1 to 0 in some quick but continuous manner as $v$ gets larger – Alex R. Nov 03 '14 at 17:35
  • @AlexR. thank you, but what I actually was looking for was a way to make players not able to go over a ceiling, so that when $ t -> \inf $ then $ a_t -> c $, where $c$ is the ceiling. – propeller Nov 04 '14 at 07:55

0 Answers0