Hey, i’m trying to create custom particle system, but i can’t understand how WindAffectsDrag affects Drag.
My code:
--[[Example values]]
local Drag = 1
local CurrentLifetime = 0.5
local Lifetime = 1
local Velocity = vector.create(-0.6, -0.5, 0.4)
local WindAffectsDrag = true
----
local DeltaLife = CurrentLifetime / Lifetime
local DeltaDrag = 2 ^ (-Drag * DeltaLife)
if WindAffectsDrag then
--???
end
local FinalVelocity = Velocity * DeltaDrag
This is the formula that I found for the speed of a particle (not 100% if that is the actual formula but the principle of how to form the new vector stays the same):
After some experementig i found out this, it almost copies roblox’s ParticleEmitter.WindAffectsDrag
local DeltaTime = task.wait()
local Velocity = vector.zero
local WindAffectsDrag = true
local Drag = 1
local DeltaDrag = WindAffectsDrag and 1 - (Drag * DeltaTime) or 2 ^ -(Drag * DeltaTime)
if WindAffectsDrag then
Velocity += workspace.GlobalWind * Drag
end
Velocity *= DeltaDrag
If anyone knows how to improve this formula, I'd be grateful.