Since Particles are basically just 2d objects they dont really have a position in 3d space that you could get (at least thats what I know, correct me if I am wrong).
I am trying to calculate the maximum hight of a particle just from the predefined values that are given. These are Drag,the Time and the Velocity when the particle starts.With just time and Velocity its very easy (V*t) but I dont know how to include drag into that.
I have already looked into the physics of a Vertical throw but from what I know Drag is based on the Velocity wich makes it really hard for me.
Now I need a calculation with wich I can calculate wich hight/position the particle will have to a given time.
Thank you for your help, if there is questions to my problem make sure to write a comment below, so I see them.
hey, correct me if my math is wrong because I have not done integrals in a while :)
your velocity at a particular time can be given as v0 * 0.5^(td), with v0 as the starting velocity and d as the drag value. this is because according to the documentation on particle emitters:
Determines the rate at which particles will lose half their speed through exponential decay
therefore you can get the integral of the velocity from zero to whatever amount of time you want to get the distance covered, which I think is what you want.
EDIT: now that we have worked out the code, I am pasting this script down here in case it helps someone.
function integral(func, start, stop, delta) local delta = delta or 1e-4 local int = 0 for x = start, stop, delta do int = int + func(x) * delta end return int end local INITIAL = 5 local DRAG = 1 function velocity(time) return INITIAL * 0.5 ^ (time * DRAG) end local END_TIME = 1 print(integral(velocity, 0, END_TIME, 0.01))
your delta value will affect the measurements' accuracy, but it will also require more calculations per seconds. you can toy around with it and find a suitable delta value.