How do I add drag to this projectile?

Hello,

I’m playing around with physics and have gotten pretty good results:

This is the equation I’m using:
p = p0 + vt + 0.5 * a * t * t

where
p = new position
p0 = starting position
v = velocity
a = acceleration (due to gravity, so negative Y axis)
t = time elapsed (starting at 0)

But, I’m wondering how to add drag to them, so that they get slower over time, so that it acts more like a “knockback” force than a constant velocity force.

A good example of what I’m talking about:

Or do I need to change the equation entirely?

I’m trying to simulate knockback with an equation that is able to use time elapsed so that I can sync it across all clients. I was thinking that adding drag to this equation would pretty much get a result close to what I want but if there’s a better way to do it please let me know.

2 Likes