Einlander Posted November 2, 2015 Posted November 2, 2015 I was messing around one day and wanted to have certain objects be weightless. So I came up with this simple code. function Script:UpdatePhysics() self.entity:AddForce(0,self.entity:GetMass()*-world:GetGravity().y,0,true) end Just wanted to share it. You can can control the amount of weightlessness by controlling the amount (%) of gravity used in the calcualtion 4 Quote
Einlander Posted November 2, 2015 Author Posted November 2, 2015 A small modification. You can now declare the percentage of gravity affecting the object. There are no limits placed on the percentage . So negative numbers will make it float up and numbers > 100 make them super heavy. Beware of large numbers because they will clip through other objects. Script.Gravity = 100 --float "Gravity Precent" function Script:UpdatePhysics() self.entity:AddForce(0,(self.entity:GetMass()*-world:GetGravity().y)*(((100-self.Gravity)/100)) ,0,true) end Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.