Chrapnel
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 951 |
|
|
| 24 Dec 2014 12:23 AM |
using the shape 'ball' on parts i can only get spheres is sizes of (1,1,1) or (2,2,2) etc
i want to be able to make it (0.5,0.5,0.5) or a decimal, but it keeps reverting to the closest whole number. changing the formfactor to 'custom' does nothing, it reverts to symmetrical.
any way around this? |
|
|
| Report Abuse |
|
flump
|
  |
| Joined: 30 Jul 2008 |
| Total Posts: 1039 |
|
|
| 24 Dec 2014 10:49 AM |
@analyze Shush just because they don't know something you do, doesn't mean you can be condescending.
At the same time though you're incorrect because Ball and Cylinder shapes are fixed to symmetrical formFactor and even changing it will still keep it locked to multiple of 1's.
@Op Place a special mesh within the Part you want to be a ball and change the MeshType to sphere. You are then able to adjust the Scale of the mesh to Smaller/More Accurate results.
If you want the physics of a smaller Ball then I think when scripting the Ball's size with its formFactor to Custom will allow you to go smaller but I'm not sure havent tested in a while. |
|
|
| Report Abuse |
|
|
| 04 Sep 2015 06:07 AM |
triangle = {} triangle.new = function (A, B, C) --Variable declarations local a, b, c, semiPerimeter, sp, area, hyp, height, angA, angB, angC, dif, right, midpoint, center1, center2, ground, ri, up, ba, angCLeft, wedge local A1, B1, C1 = A, B, C --Side lenghts a = (A-B).magnitude b = (A-C).magnitude c = (B-C).magnitude --Semi perimeter of the triangle semiPerimeter = (a+b+c)/2; sp = semiPerimeter --Area of triangle herons method area = math.sqrt(sp*(sp-a)*(sp-b)*(sp-c)) --Hypotenuse hyp = math.max(a, b, c) if hyp == a then --Rearrange points for corrent rotation A, B, C = C, A, B a, b, c = b, c, a elseif hyp == b then A, B, C = B, C, A a, b, c = c, a, b end --Height of the triangle height = area/(c/2) --Angles angA = math.asin(height/b) angB = math.asin(height/a) angC = math.pi - angA - angB --Determine if difference is a miscalculation of math.pi by checking against small increment --if that is the case, angC is a right angle. dif = math.abs((math.pi/2) - angC) angCLeft = math.pi/2 - angB ground = math.tan(angCLeft)*height midpoint = B + (C-B).unit*ground center1 = B + (C-B).unit*ground/2 + (A - midpoint).unit*(height/2) center2 = C + (B-C).unit*((c-ground)/2) + (A-midpoint).unit*(height/2) --Make rotation matrix ri = (midpoint-B).unit; up = (midpoint-A).unit ba = (midpoint-B):Cross(midpoint-A).unit local triangleModel = Instance.new("Model") --Make the first triangle wedge = Instance.new("WedgePart"); wedge.Name = "Triangle"; wedge.FormFactor = "Custom"; wedge.Anchored = true; wedge.TopSurface = "Smooth"; wedge.BottomSurface = "Smooth"; wedge.Size = Vector3.new(0,height,ground) wedge.CFrame = CFrame.new(center1.x,center1.y,center1.z, ri.x,up.x,ba.x,ri.y,up.y,ba.y,ri.z,up.z,ba.z)*CFrame.Angles(math.pi, math.pi/2,0); wedge.Parent = triangleModel wedge.TopSurface = "SmoothNoOutlines" wedge.LeftSurface = "SmoothNoOutlines" wedge.BackSurface = "SmoothNoOutlines" wedge.RightSurface = "SmoothNoOutlines" wedge.FrontSurface = "SmoothNoOutlines" wedge.BottomSurface = "SmoothNoOutlines" local mesh = Instance.new("SpecialMesh", wedge) mesh.MeshType = "Wedge" mesh.Scale = Vector3.new(0,1,1) if right then return triangleModel end --If the triangle is right, only one wedge is required ri = (midpoint-C).unit up = (midpoint-A).unit ba = (midpoint-C):Cross(midpoint-A).unit wedge = wedge:Clone() wedge.Size = Vector3.new(0,height,c-ground) wedge.CFrame = CFrame.new(center2.x,center2.y,center2.z, ri.x,up.x,ba.x,ri.y,up.y,ba.y,ri.z,up.z,ba.z)*CFrame.Angles(math.pi, math.pi/2,0); wedge.Parent = triangleModel return triangleModel end
part = Instance.new("Part") part.Anchored = true part.FormFactor = "Custom" part.Size = Vector3.new(.4,.4,.4) part.BrickColor = BrickColor.Red()
pos = Vector3.new(0,100,0)
freq = 1/2
pi = math.pi res = 20 r = 10 step = pi/res
s = Instance.new("Model")
c = part:Clone() c.Name = "c" c.CFrame = CFrame.new() + pos c.Parent = s
seed1 = math.random()*10000 seed2 = math.random()*10000 seed3 = math.random()*10000 seed4 = math.random()*10000
function weldTogether(part0, part1) local newWeld = Instance.new("Weld") newWeld.Part0 = part0 newWeld.Part1 = part1 newWeld.C0 = CFrame.new() newWeld.C1 = part1.CFrame:toObjectSpace(part0.CFrame) newWeld.Parent = part0 end
for p = -((res/2)-1)*step, ((res/2)-1)*step, step do wait() for y = 0, pi*2, step do local self = (CFrame.new()+pos) * CFrame.Angles(0,y,0) self = self * CFrame.Angles(p,0,0) self = self + self.lookVector * r local right = (CFrame.new()+pos) * CFrame.Angles(0,y + step,0) right = right * CFrame.Angles(p,0,0) right = right + right.lookVector * r local up = (CFrame.new()+pos) * CFrame.Angles(0,y,0) up = up * CFrame.Angles(p + step,0,0) up = up + up.lookVector * r local left = (CFrame.new()+pos) * CFrame.Angles(0,y - step,0) left = left * CFrame.Angles(p,0,0) left = left + left.lookVector * r local down = (CFrame.new()+pos) * CFrame.Angles(0,y,0) down = down * CFrame.Angles(p - step,0,0) down = down + down.lookVector * r local t1 = triangle.new(self.p, right.p, up.p) t1.Parent = s local t2 = triangle.new(self.p, left.p, down.p) t2.Parent = s local ch1 = t1:GetChildren() local ch2 = t2:GetChildren() local n1 = math.noise(p/freq, y/freq, seed1) local n2 = math.noise(p/freq, y/freq, seed2) for _, v1 in pairs(ch1) do if v1:IsA("BasePart") then v1.BrickColor = BrickColor.Blue() end end for _, v2 in pairs(ch2) do if v2:IsA("BasePart") then v2.BrickColor = BrickColor.Blue() end end for _, v1 in pairs(ch1) do if v1:IsA("BasePart") then if n2 > .05 then --v1.BrickColor = BrickColor.Yellow() end if n2 > .1 then v1.BrickColor = BrickColor.Green() end if n2 > .4 then v1.BrickColor = BrickColor.new("Mid grey") end end end for _, v2 in pairs(ch2) do if v2:IsA("BasePart") then if n2 > .25 then v2.BrickColor = BrickColor.Yellow() end if n2 > .3 then v2.BrickColor = BrickColor.Green() end if n2 > .45 then v2.BrickColor = BrickColor.new("Mid grey") end end end for _, v1 in pairs(ch1) do if v1:IsA("BasePart") then if n1 > .35 then v1.BrickColor = BrickColor.White() end end end for _, v2 in pairs(ch2) do if v2:IsA("BasePart") then if n1 > .35 then v2.BrickColor = BrickColor.White() end end end repeat local p = s:FindFirstChild("Triangle", true) if p then p.Name = "PartV" weldTogether(c, p) end until not p repeat local p = s:FindFirstChild("PartV", true) if p then p.Name = "Part" p.Anchored = false end until not p end end
s.Parent = game.Workspace c.Anchored = false |
|
|
| Report Abuse |
|