|
| 29 Jul 2014 11:34 AM |
A friend made a gun and asked me to script it for him, but when i turned it into a tool its to heavy for the player. It causes anyone who's carrying it's feet to sink into the ground.
I've had someone suggest putting a body force equal the the guns mass*192 into the handle, and i tried that but it had the effect of a gravity coil when you jumped.
Are there any other ways of making the player not sink through the ground? |
|
|
| Report Abuse |
|
|
| |
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 29 Jul 2014 11:39 AM |
| Are the parts as thin as they could be? I've never worked with mass, so would that have any effect? |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:40 AM |
@connor
I'm not really sure. It was made as a big model and resized with a plugin to be tool-sized |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:46 AM |
| Is there a way to fix this or does the gun need to be remade? |
|
|
| Report Abuse |
|
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 29 Jul 2014 11:47 AM |
| Meshes are the easiest way to go. With player made guns, you have to weld every single part together. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:48 AM |
@connor
Thats what I did. I know there are other games on roblox with guns with large amounts of bricks, so why does mine sink through the floor? |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:48 AM |
I'll repost what I said here: http://www.roblox.com/Forum/ShowPost.aspx?PostID=141877366
Use a bodyforce to cancel the gravity out. I don't know for sure how the process goes, but the gravity coil has a piece of code that makes hats weightless.
But I think it goes like this
local modelstuff = modelhere:GetChildren() local totalforce = 0 for i=1,#modelstuff do if modelstuff[i].ClassName == "Part" then local totalforce = totalforce + modelstuff[i]:GetMass() end end --then you multiply it by some number that I forgot, and put it in the bodyforce in handle |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:50 AM |
@teh
I did that. I got the mass, multiplied it by 192, and then inserted it into the handle in a body force.
It just makes me float up when i jump |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:53 AM |
wtf
haven't any of you learned from guns on free mods? Thats how I started making guns (but now I use models for my guns, not those ugly slopy toolz)
this script is supposed to weld a gun together when equipped. (the gun must be anchored)
function Weld(x,y) local W = Instance.new("Weld") W.Part0 = x W.Part1 = y local CJ = CFrame.new(x.Position) local C0 = x.CFrame:inverse()*CJ local C1 = y.CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = x end
function Get(A) if A.className == "Part" then Weld(script.Parent.Handle, A) A.Anchored = false else local C = A:GetChildren() for i=1, #C do Get(C[i]) end end end
function Finale() Get(script.Parent) end
script.Parent.Equipped:connect(Finale) script.Parent.Unequipped:connect(Finale) Finale() |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:55 AM |
The BodyForce thing doesn't work, I had the same issue with morphs I made a while ago.
My solution was to resize everything to 0.2x0.2x0.2 and insert meshes/resize meshes. I have a script for it, here you go:
local function RemoveWeight(model) local function recursive(obj) for _, child in pairs(obj:GetChildren()) do if child:IsA("BasePart") then local cf = child.CFrame local has_mesh = false for _, mesh in pairs(child:GetChildren()) do if mesh:IsA("BevelMesh") then has_mesh = true mesh.Scale = mesh.Scale * child.Size * 5 elseif mesh:IsA("SpecialMesh") then has_mesh = true if mesh.MeshType.Name ~= "FileMesh" then mesh.Scale = mesh.Scale * child.Size * 5 end end end if not has_mesh then Instance.new("BlockMesh", child).Scale = child.Size * 5 end child.formFactor = "Custom" child.Size = Vector3.new(0.2, 0.2, 0.2) child.CFrame = cf end recursive(child) end end recursive(model) end
RemoveWeight(Workspace.Model) -- Change that to the gun |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:55 AM |
@Accomplishable
did you even read my post?
I made the tool. Its all welded together. But when i equip it, the tool(which is welded together), causes my legs(the ones on my character) to fall through the ground.
Thank you for trying to help, but my post doesnt even mention welds in it |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:55 AM |
| @op Use a smaller number then. (for example, divide 192 by 0.5, to give it half the gravitational pull.) |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 11:55 AM |
| Accomplishable, that's not the problem. |
|
|
| Report Abuse |
|
|
| |
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 29 Jul 2014 12:04 PM |
| With the CSG Modeler coming out, soon you won't have to worry about this at all... |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 12:17 PM |
| Actually the CSG wouldn't really help at all, since it would be the same mass. You'd still need my workaround. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 12:22 PM |
nice actually is is less mass
you can have 10000 parts in 1 cube meter or one part that is 1 meter by 1 meter |
|
|
| Report Abuse |
|
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 29 Jul 2014 12:23 PM |
| CSG will be a sight for sore eyes to the old custom mesh makers. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 01:21 PM |
| I was actually referring to connor's post, where he said it's easier to use meshes, and since you have to weld every single part in the gun together. You were replying after that, so I referred to both of you |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 29 Jul 2014 01:22 PM |
Actually, it would be less mass.
Mass ~= volume |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 01:23 PM |
| And if your gun's making you fall through the ground, how about you use common sense and make it smaller (I'm sure you're not THAT stupid enough to where you can't even build it). Don't see why you're posting a thread because your gun is too big. Get a brain, flower head |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 29 Jul 2014 01:25 PM |
@Accomp,
resizing a gun can be some unneeded work if he's just looking for a way to reduce its weight. Besides, resizing might ruin some aesthetic to the gun (maybe he was going for big).
I don't blame him at all for making this thread. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2014 01:25 PM |
And to anyone besides the OP,
tl;dr |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 29 Jul 2014 01:27 PM |
>And to anyone besides the OP,
tl;dr
>Actually, it would be less mass.
Mass ~= volume
much lazy, such wow |
|
|
| Report Abuse |
|
|