Math behind ParticleEmitter.WindAffectsDrag?

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
2 Likes

It’s probably pretty basic but I’m not sure of the math involved.
https://create.roblox.com/docs/reference/engine/classes/ParticleEmitter#WindAffectsDrag

Try this article:
https://create.roblox.com/docs/environment/global-wind#particle-influence

I have already looked at these pages, but they did not help me with my problem.

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):

VelocityAtTime = StartVelocity×e^(−Drag×TimePassed)

I would assume that you can apply this formula to each Vector axis seperately and piece them back together in the end

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.

I’ll leave this post without solution, for now.