M4LLARDJoin Date: 2012-08-13 Post Count: 3201 |
Out of interest, is there a way to do this? And also to have gravity inside a room.
I'm trying to make a space station but I don't want people to fall outside, but still have gravity inside like in Star Wars
~IanSplodge, Walrus god of the forums |
|
ContraryJoin Date: 2011-01-08 Post Count: 1306 |
I'm not sure, but if you figure it out, let me know. That would be a cool thing to know how to do. |
|
M4LLARDJoin Date: 2012-08-13 Post Count: 3201 |
Alright.
I know there's a way to make custom physics, could this be included?
~IanSplodge, Walrus god of the forums |
|
|
Sure. Mess around with this a LOT.
local bf = Instance.new("BodyForce", player.Torso")
bf.Force = Vector3.new(0,196.2,0) * player.Torso:GetMass()
My old post might be useful for weightless models.
Edit at risk.
local parts = script.Parent.Parent.Parent:GetChildren()
local totalmass = 0
for i = 1,#parts do
if parts[i]:IsA("BasePart") or parts[i]:IsA("UnionOperation") then
local newmass = parts[i]:GetMass()
totalmass = totalmass + newmass
end
end
script.Parent.Force = Vector3.new(0,196.2,0) * (totalmass)
|
|
darthpyroJoin Date: 2009-08-18 Post Count: 3569 |
|
|
M4LLARDJoin Date: 2012-08-13 Post Count: 3201 |
Thanks!
Will the code include the mass of hats though?
~IanSplodge, Walrus god of the forums |
|
NewVoidsJoin Date: 2013-12-24 Post Count: 696 |
Why not just do if the floor of the place was touched then set JumpPower (humanoid) to like default and if you're outside then it goes to 100 or whatever
|
|
M4LLARDJoin Date: 2012-08-13 Post Count: 3201 |
I think you're misunderstanding JumpPower here.
~IanSplodge, Walrus god of the forums |
|
|
It does not include hats, so you might want to use one of those functions that finds all the parts in the model. Look up recursive functions if you don't know how to do that yet, and contact me if you're still having trouble after that. |
|
M4LLARDJoin Date: 2012-08-13 Post Count: 3201 |
Thanks lord, I can probably work it out. I'm going to start working on my spaceship now.
~IanSplodge, Walrus god of the forums |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
Hi Mr.Torso! |
|
M4LLARDJoin Date: 2012-08-13 Post Count: 3201 |
What do you want 62GB, because I know what I don't want here, and that's you.
~IanSplodge, Walrus god of the forums |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
I just remembered you from that first person shooter you were making. I'm calling you Mr.Torso cause you completely ignored my fix I sent you..
._. |
|
M4LLARDJoin Date: 2012-08-13 Post Count: 3201 |
I am aware, I don't need to be told by the likes of you.
~IanSplodge, Walrus god of the forums |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
You obviously needed some guidance at that time. All I was doing was simply telling you what to do in order to fix it. That's it. kthxbai |
|
|
You could do something like this:
local function SetGravity(model)
for _,child in pairs(model:GetChildren()) do
if child:IsA("Part") or child:IsA("UnionOperation") then
local bodyForce = Instance.new('BodyForce',child)
bodyForce.Force = child:GetMass()*Vector3.new(0,196.2,0)
elseif child:IsA("Model") or child:IsA("Hat") then
SetGravity(child)
end
end
end
--makes sure to get any hats that may still be loading
character.DescendantAdded:connect(function(child)
if child:IsA("Hat") then
SetGravity(child)
end
end)
Though this would make a new BodyForce instance inside each part. You could probably setup something similar that adds up all the mass and makes a single BodyForce in the model's PrimaryPart.
FilteringDisabled is for squares |
|