null nil RBX1 0 0 0 0 1 0 0 0 1 0 0 0 1 Workspace null null 0 66.5552368 28.3831482 10.512208 0.187403545 -0.102697119 0.976899803 -0 0.994519711 0.104549415 -0.982283056 -0.0195929315 0.186376512 70 47.0172424 26.29216 6.78467798 1 0 0 0 1 0 0 0 1 Camera true -0.5 0.5 0 0 -0.5 0.5 4 0 194 -2 126 -2 1 0 0 0 1 0 0 0 1 true 0.5 0.300000012 -0.5 0.5 0 0 -0.5 0.5 0 0 true 256 Terrain 0 -0.5 0.5 0 0 0 0 0 -0.5 0.5 3 0 0 0 0 0 2044 252 2044 false Script local testService = game.ManualJointHelperTest local terrainCellSize = Vector3.new(4, 4, 4) local part = Instance.new("Part") local part2 = Instance.new("Part") local part3 = Instance.new("WedgePart") part.Anchored = true part2.Anchored = true part3.Anchored = true local joinableSurfaceTypes = {"Smooth", "Glue", "Weld", "Inlet", "Studs", "Universal", "Hinge", "Motor", "SteppingMotor", "Unjoinable"} local surfaces = {"BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface"} local reverseFaceMapping = {3, 6, 1, 5, 4, 2} local surfaceToWorldAxisMapping = {Vector3.new(0, 0, 1), Vector3.new(0, -1, 0), Vector3.new(0, 0, -1), Vector3.new(-1, 0, 0), Vector3.new(1, 0, 0), Vector3.new(0, 1, 0)} function testJoin(partA, partB, whichAxis) local madeJoint = false -- position partA next to partB partA.CFrame = partB.CFrame + partB.CFrame:vectorToWorldSpace(whichAxis * (partB.Size/2 + partA.Size/2)) -- and then join and see if welds are created partA.Parent = game.Workspace partB.Parent = game.Workspace game.JointsService:SetJoinAfterMoveInstance(partA) game.JointsService:CreateJoinAfterMoveJoints() -- if there are any children, it's because a weld formed madeJoint = ( #(partA:GetChildren()) > 0 or #(partB:GetChildren()) > 0 ) for a = 1, #partA:GetChildren() do partA:GetChildren()[a]:Remove() end for b = 1, #partB:GetChildren() do partB:GetChildren()[b]:Remove() end -- make them go away now partA.Parent = nil partB.Parent = nil return madeJoint end function testTerrainJoin(partA, partB, whichAxis) local madeJoint = false -- position partA next to partB partA.CFrame = partB.CFrame + partB.CFrame:vectorToWorldSpace(whichAxis * (partB.Size/2 + partA.Size/2)) -- and then join and see if welds are created partA.Parent = game.Workspace game.JointsService:SetJoinAfterMoveInstance(partA) game.JointsService:CreateJoinAfterMoveJoints() -- if there are any children, it's because a weld formed madeJoint = #(partA:GetChildren()) > 0 for a = 1, #partA:GetChildren() do partA:GetChildren()[a]:Remove() end -- make them go away now partA.Parent = nil return madeJoint end function testJoinToAllSurfaces(partA, partB) local numJoins = 0 for i = 1, 6 do for j = 1, #joinableSurfaceTypes do local oldSurfaceA = partA[surfaces[i]] partA[surfaces[i]] = joinableSurfaceTypes[j] for k = 1, #joinableSurfaceTypes do local oldSurfaceB = partB[surfaces[reverseFaceMapping[i]]] partB[surfaces[reverseFaceMapping[i]]] = joinableSurfaceTypes[k] if testJoin(partA, partB, surfaceToWorldAxisMapping[reverseFaceMapping[i]]) then --print(joinableSurfaceTypes[j], joinableSurfaceTypes[k]) numJoins = numJoins + 1 end partB[surfaces[reverseFaceMapping[i]]] = oldSurfaceB end partA[surfaces[i]] = oldSurfaceA end --print(numJoins) end return numJoins end function testJoinToTerrainAllSurfaces(partA, partB) local numJoins = 0 for i = 1, 6 do for j = 1, #joinableSurfaceTypes do local oldSurfaceA = partA[surfaces[i]] partA[surfaces[i]] = joinableSurfaceTypes[j] if testTerrainJoin(partA, partB, surfaceToWorldAxisMapping[reverseFaceMapping[i]]) then --print(joinableSurfaceTypes[j]) numJoins = numJoins + 1 end partA[surfaces[i]] = oldSurfaceA end --print(numJoins) end return numJoins end -- basic test suite part2.CFrame = CFrame.new() testService:Check( testJoinToAllSurfaces(part, part2) == 24, "ManualJointHelper: Two blocks test" ) -- only 4 combinations of surface types makes a weld * 6 faces -- test with a ball part2.Shape = "Ball" testService:Check( testJoinToAllSurfaces(part, part2) == 0, "ManualJointHelper: Block and ball test" ) -- test with an off-axis brick part2.Shape = "Block" part2.CFrame = CFrame.Angles(.1, math.pi+.2, .7) testService:Check( testJoinToAllSurfaces(part, part2) == 24, "ManualJointHelper: Off-axis blocks test" ) -- test with a default wedge part3.CFrame = CFrame.new() testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Wedge-block test 1" ) -- test with an off-axis wedge part3.CFrame = CFrame.Angles(.1, math.pi+.2, .7) testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Off-axis wedge-block test 1" ) -- test with a wedge whose default sides are all unjoinable for i = 1, 6 do part3[surfaces[i]] = "Unjoinable" end part3.CFrame = CFrame.new() testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Wedge-block test 2" ) -- off-axis previous test part3.CFrame = CFrame.Angles(.1, math.pi+.2, .7) testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Off-axis wedge-block test 2" ) -- test with a terrain block local oldValA, oldValB, oldValC = game.Workspace.Terrain:GetCell(0, 0, 0) game.Workspace.Terrain:SetCell(0, 0, 0, 1, 0, 0) local fakeTerrainPart = Instance.new("Part") fakeTerrainPart.formFactor = "Custom" fakeTerrainPart.Size = terrainCellSize fakeTerrainPart.CFrame = CFrame.new(game.Workspace.Terrain:CellCenterToWorld(0, 0, 0)) testService:Check( testJoinToTerrainAllSurfaces(part, fakeTerrainPart) == 54, "ManualJointHelper: Basic block-terrain test" ) -- everything except Unjoinable makes a weld (9*6) testService:Check( testJoinToTerrainAllSurfaces(part3, fakeTerrainPart) == 36, "ManualJointHelper: Basic wedge-terrain test" ) game.Workspace.Terrain:SetCell(0, 0, 0, oldValA, oldValB, oldValC) --_G["testJoin"] = testJoin -- for manual testing true -0.5 0.5 0 0 -0.5 0.5 4 0 194 1 10.2000008 -10 1 0 0 0 1 0 0 0 1 true 0.5 0.300000012 -0.5 0.5 0 0 -0.5 0.5 0 0 false 256 PartA 0 -0.5 0.5 0 0 0 0 0 -0.5 0.5 3 0 0 0 0 0 1 1 4 1.20000005 2 true -0.5 0.5 0 0 -0.5 0.5 4 0 194 0 9 -10 1 0 0 0 1 0 0 0 1 true 0.5 0.300000012 -0.5 0.5 0 0 -0.5 0.5 0 0 false 256 PartB 0 -0.5 0.5 0 0 0 0 0 -0.5 0.5 3 0 0 0 0 0 1 1 4 1.20000005 2 true -0.5 0.5 0 0 -0.5 0.5 4 0 194 -1 21.2000008 -2 1 0 0 0 1 0 0 0 1 false 0.5 0.300000012 -0.5 0.5 0 0 -0.5 0.5 0 0 false 256 Wedge 0 -0.5 0.5 0 0 0 0 0 -0.5 0.5 0 0 0 0 0 0 1 4 1.20000005 2 StarterPack StarterGui true 0 10 1 Soundscape 1 CollectionService PhysicsService BadgeService Geometry RenderHooksService SocialService 1000 Debris Instance Instance CookiesService Teleport Service Players Selection 4286611584 1 4278190080 4278190080 4290822336 100000 0 41.7332993 Lighting 4289967032 1 0 14:00:00 ChangeHistoryService Tests the "Unjoinable" SurfaceType true true true ManualJointHelperTest 10 false Script local testService = script.Parent local terrainCellSize = Vector3.new(4, 4, 4) local part = Instance.new("Part") local part2 = Instance.new("Part") local part3 = Instance.new("WedgePart") part.Anchored = true part2.Anchored = true part3.Anchored = true local joinableSurfaceTypes = {"Smooth", "Glue", "Weld", "Inlet", "Studs", "Universal", "Hinge", "Motor", "SteppingMotor", "Unjoinable"} local surfaces = {"BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface"} local reverseFaceMapping = {3, 6, 1, 5, 4, 2} local surfaceToWorldAxisMapping = {Vector3.new(0, 0, 1), Vector3.new(0, -1, 0), Vector3.new(0, 0, -1), Vector3.new(-1, 0, 0), Vector3.new(1, 0, 0), Vector3.new(0, 1, 0)} function testJoin(partA, partB, whichAxis) local madeJoint = false -- position partA next to partB partA.CFrame = partB.CFrame + partB.CFrame:vectorToWorldSpace(whichAxis * (partB.Size/2 + partA.Size/2)) -- and then join and see if welds are created partA.Parent = game.Workspace partB.Parent = game.Workspace game.JointsService:SetJoinAfterMoveInstance(partA) game.JointsService:CreateJoinAfterMoveJoints() -- if there are any children, it's because a weld formed madeJoint = ( #(partA:GetChildren()) > 0 or #(partB:GetChildren()) > 0 ) for a = 1, #partA:GetChildren() do partA:GetChildren()[a]:Remove() end for b = 1, #partB:GetChildren() do partB:GetChildren()[b]:Remove() end -- make them go away now partA.Parent = nil partB.Parent = nil return madeJoint end function testTerrainJoin(partA, partB, whichAxis) local madeJoint = false -- position partA next to partB partA.CFrame = partB.CFrame + partB.CFrame:vectorToWorldSpace(whichAxis * (partB.Size/2 + partA.Size/2)) -- and then join and see if welds are created partA.Parent = game.Workspace game.JointsService:SetJoinAfterMoveInstance(partA) game.JointsService:CreateJoinAfterMoveJoints() -- if there are any children, it's because a weld formed madeJoint = #(partA:GetChildren()) > 0 for a = 1, #partA:GetChildren() do partA:GetChildren()[a]:Remove() end -- make them go away now partA.Parent = nil return madeJoint end function testJoinToAllSurfaces(partA, partB) local numJoins = 0 for i = 1, 6 do for j = 1, #joinableSurfaceTypes do local oldSurfaceA = partA[surfaces[i]] partA[surfaces[i]] = joinableSurfaceTypes[j] for k = 1, #joinableSurfaceTypes do local oldSurfaceB = partB[surfaces[reverseFaceMapping[i]]] partB[surfaces[reverseFaceMapping[i]]] = joinableSurfaceTypes[k] if testJoin(partA, partB, surfaceToWorldAxisMapping[reverseFaceMapping[i]]) then --print(joinableSurfaceTypes[j], joinableSurfaceTypes[k]) numJoins = numJoins + 1 end partB[surfaces[reverseFaceMapping[i]]] = oldSurfaceB end partA[surfaces[i]] = oldSurfaceA end --print(numJoins) end return numJoins end function testJoinToTerrainAllSurfaces(partA, partB) local numJoins = 0 for i = 1, 6 do for j = 1, #joinableSurfaceTypes do local oldSurfaceA = partA[surfaces[i]] partA[surfaces[i]] = joinableSurfaceTypes[j] if testTerrainJoin(partA, partB, surfaceToWorldAxisMapping[reverseFaceMapping[i]]) then --print(joinableSurfaceTypes[j]) numJoins = numJoins + 1 end partA[surfaces[i]] = oldSurfaceA end --print(numJoins) end return numJoins end -- basic test suite part2.CFrame = CFrame.new() testService:Check( testJoinToAllSurfaces(part, part2) == 24, "ManualJointHelper: Two blocks test" ) -- only 4 combinations of surface types makes a weld * 6 faces -- test with a ball part2.Shape = "Ball" testService:Check( testJoinToAllSurfaces(part, part2) == 0, "ManualJointHelper: Block and ball test" ) -- test with an off-axis brick part2.Shape = "Block" part2.CFrame = CFrame.Angles(.1, math.pi+.2, .7) testService:Check( testJoinToAllSurfaces(part, part2) == 24, "ManualJointHelper: Off-axis blocks test" ) -- test with a default wedge part3.CFrame = CFrame.new() testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Wedge-block test 1" ) -- test with an off-axis wedge part3.CFrame = CFrame.Angles(.1, math.pi+.2, .7) testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Off-axis wedge-block test 1" ) -- test with a wedge whose default sides are all unjoinable for i = 1, 6 do part3[surfaces[i]] = "Unjoinable" end part3.CFrame = CFrame.new() testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Wedge-block test 2" ) -- off-axis previous test part3.CFrame = CFrame.Angles(.1, math.pi+.2, .7) testService:Check( testJoinToAllSurfaces(part, part3) == 16, "ManualJointHelper: Off-axis wedge-block test 2" ) -- test with a terrain block local oldValA, oldValB, oldValC = game.Workspace.Terrain:GetCell(0, 0, 0) game.Workspace.Terrain:SetCell(0, 0, 0, 1, 0, 0) local fakeTerrainPart = Instance.new("Part") fakeTerrainPart.formFactor = "Custom" fakeTerrainPart.Size = terrainCellSize fakeTerrainPart.CFrame = CFrame.new(game.Workspace.Terrain:CellCenterToWorld(0, 0, 0)) testService:Check( testJoinToTerrainAllSurfaces(part, fakeTerrainPart) == 54, "ManualJointHelper: Basic block-terrain test" ) -- everything except Unjoinable makes a weld (9*6) testService:Check( testJoinToTerrainAllSurfaces(part3, fakeTerrainPart) == 36, "ManualJointHelper: Basic wedge-terrain test" ) game.Workspace.Terrain:SetCell(0, 0, 0, oldValA, oldValB, oldValC) --_G["testJoin"] = testJoin -- for manual testing