generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: how to cake custom sized spheres

Previous Thread :: Next Thread 
Chrapnel is not online. 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
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
24 Dec 2014 12:25 AM
@title, make*

lol
Report Abuse
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
24 Dec 2014 12:25 AM
ppl are so dumb when it comes to meshes
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
24 Dec 2014 12:27 AM
sorry i don't know anything about meshes, could you please tell me?
Report Abuse
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
24 Dec 2014 12:29 AM
most common issue is that the part's `formFactor` is not set to 3 (which means customizable at any shape/size)
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
24 Dec 2014 12:31 AM
'changing the formfactor to 'custom' does nothing, it reverts to symmetrical'

--tried it.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
24 Dec 2014 12:44 AM
Le mesh
Report Abuse
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
24 Dec 2014 10:30 AM
lol u did something to ur studio then
Report Abuse
flump is not online. 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
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
24 Dec 2014 11:22 AM
if you want to resize balls smaller, you can't go smaller than .1,.1,.1 I believe but you can use a SpecialMesh just change the type to Sphere
Report Abuse
Kevinllululala is online. Kevinllululala
Joined: 03 Mar 2013
Total Posts: 823
04 Sep 2015 06:01 AM
1. Roblox studio only allows sphere to be 1 stud
2. Mesh won't make the ball roll like a sphere
Report Abuse
distalDigitPhalanx is not online. distalDigitPhalanx
Joined: 25 Jan 2015
Total Posts: 1509
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
Kevinllululala is online. Kevinllululala
Joined: 03 Mar 2013
Total Posts: 823
06 Sep 2015 01:55 AM
1.Make a sphere part
2. Union it
3. After union it you will be able to resize it
4. resize it to any size between 0.2-1
5. Click seperate

Just discovered it yesterday
Report Abuse
SuperAndroid45 is not online. SuperAndroid45
Joined: 04 Oct 2011
Total Posts: 2
24 Jan 2016 05:04 PM
Thanks man big help!
Report Abuse
beast13890 is not online. beast13890
Joined: 01 Mar 2013
Total Posts: 3
08 Oct 2017 03:21 PM
Thanks. Actually worked. God I thought I was gonna have to ditch the spheres. Thanks again
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image