Physics Gravity Simulation in Roblox Studio
Real Physics Gravity Simulation in Roblox Studio Planetary Gravity i used the relation: (M+M')/d² The Script: --Created By CodesOtaku 26/06/2018, 22:36 (GMT 0+) local Objects = game.Workspace.Objects --Objects Model
game:GetService("RunService").RenderStepped:connect(function() for x,object in pairs(Objects:GetChildren()) do local force = object.DefaultForce.Value local mass = object.Density.Valueobject:GetMass() --Calculating the force needed for y,otherObject in pairs(Objects:GetChildren()) do if otherObject ~= object then local otherMass = otherObject.Density.ValueotherObject:GetMass() local vector = (otherObject.Position-object.Position) local distance = vector.magnitude local scalarForce = (mass+otherMass)/math.pow(distance, 2) force = force+(vector.Unit*scalarForce) end end --Appliying the force to the object object.BodyForce.Force = force end end) ... https://www.youtube.com/watch?v=GsMEvauTcJg
4031519 Bytes