|
| 21 Jan 2015 05:43 PM |
I have a physical array of parts and I want to weld every part to it's surrounding parts, but not to any that isn't right next to it. What's the best way of doing so? Ex:
X is the selected part
O is a regular part
Z is parts that should weld to X
O O Z O O Z X Z O O Z O |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 06:02 PM |
--Well. Here's an attempt, doesn't work but no error. I notice there's only 1 weld per part but they don't weld
local function weld(p0, p1, type) local w = Instance.new(type) w.Part0 = p0 w.Part1 = p1 w.C0 = CFrame.new() w.C1 = p1.CFrame:toObjectSpace(p0.CFrame) w.Parent = p0 return w end
for i,v in pairs (script.Parent:GetChildren()) do if v:isA("BasePart") then local curpos = v.Position for x,z in pairs (script.Parent:GetChildren()) do if z:isA("BasePart") then if (curpos-z.Position).Magnitude <=1.9 then weld(z, v, "Weld") end end end end end |
|
|
| Report Abuse |
|
|
Sercity
|
  |
| Joined: 07 Jul 2014 |
| Total Posts: 156 |
|
|
| 21 Jan 2015 06:03 PM |
idk maybe raycast
"Raycasting describes the act of casting a ray from a certain point in a certain direction, and determining what it collides with."
probably not |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 06:04 PM |
| XD any idea is a good idea |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 06:06 PM |
| Would it be acceptable to call this networking or would that be an ignorant thing to call it? I feel like it has to have a name |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 08:43 PM |
Basically I'm asking how this dude did it
http://www.roblox.com/Cloth-Simulation-place?id=137996622 |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 08:46 PM |
| Look up "Verlet Integration". Get ready for math. |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 08:53 PM |
| ^ But wouldn't roblox already calculate most of that for you with the glue joint? |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 09:05 PM |
But he didn't use the glue joint. At least, I'm pretty certain. But yes, the glue joints on Roblox most definitely use a form of Verlet Integration. |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 09:06 PM |
pfft here goes a weak attempt assuming that's a 2d array with a given x and y index
function weld(array, x, y) for i, v in ipairs {{0, -1}, {-1, 0}, {1, 0}, {0, 1}} do if array[x + v[1]] then if array[x + v[1]][y + v[2]] then --do some welding !!!!! end end end end
weld({{o, o, z, o}, {o, z, x, z}, {o, o, z, o}}, 2, 3) |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 09:07 PM |
| Looking at it more I can tell he didn't use the glue joints because it's able to compress and what not, but I'm looking for a cheater's route haha. Maybe I'll get off my lazy butt and try verlet integration. Seems like a challenge |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 09:08 PM |
| If you want a challenge, try understanding Simplex Noise. |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jan 2015 11:05 PM |
Thanks Jarod! Check out what I figured out at my place :)
http://www.roblox.com/Cape-Simulator-2015-place?id=206122684 |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2015 11:06 PM |
| And I didn't use glue joints |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 29 Jan 2015 11:39 PM |
| quenty has a script that does welding like this |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2015 11:44 PM |
Thanks Time ^_^
@above I don't doubt it :3 |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2015 11:53 PM |
| Your place has been added to my list of places that I wish I could have and dissect the code. Maybe I'll give it a shot myself. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 05:46 PM |
| ^ Good luck! I followed a guide I found online and it was actually much easier than I thought it would be (I made the mistake of looking at wikipedia and was discouraged). Start simple and work your way up, and don't get discouraged if it doesn't work :) |
|
|
| Report Abuse |
|
|