I know the formula for centripetal force, however, I can't get it to work in Roblox. Here is my current code:
wait(0.5)
local RunService = game:GetService("RunService")
RunService.RenderStepped:connect(function()
local Part = workspace.Part
local Center = workspace.Center
local m = Part:GetMass()
local r = (Part.Position - Center.Position).magnitude
local v = Vector3.new(math.sqrt(Part.Velocity.x), math.sqrt(Part.Velocity.y), math.sqrt(Part.Velocity.z))
local mv = m * v
local fc = (m * v/r)
Part.Velocity = fc
end)
Whenever the script runs, it destroys the part (I assume that the velocity is carrying it below the destroy point) and I can't figure out how to fix it. Also, I'm waiting 0.5 seconds so that workspace.Part has enough time to drop someways and gain momentum. Also, here's a link to the Wikipedia page on centripetal force: https://en.wikipedia.org/wiki/Centripetal_force
Thanks in advance, Br4veh3art23

3 comments
I don't think the Variable mv was ever used.
I also don't think :GetMass() returns Vector3 values.
Alright, I now have set m to be a Vector3 variable (All of the values are Part:GetMass()) and am now using mv, and changed it to Vector3.new(m * v), still not working.