How are particles physics calculated

I want to make a projectile system just like how particles work, with an acceleration value and a speed value.

the speed will be editable value, and the acceleration will be something changeable but by default Vector3.New(0,GRAVITY,0)

the direction is just which way the projectile is facing

how can I calculate a parts position and orientation every 1/60 of a second like particles

I have this:

while task.wait(1/60) do
		for _,v in Container:GetChildren() do
			if v:IsA("BasePart") then
				v.Position+=v.CFrame.LookVector*(v:GetAttribute("Force")+ (-math.clamp(v.Orientation.X,-90,0)/v.Gravity.Value ))
				v.Orientation+=Vector3.new(-v.Gravity.Value/100,0,0)
				if v.Orientation.X<=-80 then
				end
			end
		end
	end

but it does not work much the way I want it to, if I set force to 0 it still goes up because I am trash scripter. so how can I calculate it like particles?

I found this tutorial that I can use

hopefully I will udnerstand this ttiorial

1 Like

Is the direction of your particle in one dimension?

1 Like

I am:

moving a part, in the three dimensional space, with scripts. I want to move this part as such a particle would move

1 Like

I am unsure how you would calculate it for the Z-axis but I know equations for the others.

Y_Position = StartPosition + Velocity*Time + (1/2)*Gravity*(Time)^2
X_Position = StartPosition + Velocity * Time

2 Likes

I will try this out and if I can also get z axis to work I’ll mark this a solution

1 Like

I knoew startposition are vector and time is number, but what about velocity and gravity?

are velocity and gravity vector or number or different

edit : I foudn out

1 Like

I used the tutorial I provided above and was able to create a realistic projectile system.

1 Like

For mine I had to create an equation where I would derive the ideal gravity for it lol :joy:

For the velocities, they were variables so I could control how fast and high my projectiles go and still reach the target

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.