Just a little something that can make you flat shape disc.
example code
Rem Project: makeobjectdisc
Rem Created: 30/01/2009 16:35:31
Rem ***** Main Source File *****
sync on
sync rate 60
autocam off
position camera 0,20,-10
point camera 0,0,0
make_object_disc(1,5.0,4.9.0)
do
center text screen width()/2,0,"disc shaped object made with box and cylinder using PERFORM CSG DIFFERENCE "
rotate object 1,x#,0,0
inc x#,.1
sync
loop
function make_object_disc(id,radius as float height as float)
if height>radius then EXIT PROMPT "Height larger than radius","Height Error":end
local mesh mesh2
mesh = 100000
mesh2 = 100001
rem make a square table
make object box id,radius,height,radius
rem cut out disc
make object cylinder id+1,-radius
make mesh from object mesh,id+1
rem save the mesh file
if file exist("testmesh.x")=1 then delete file "testmesh.x"
save mesh "testmesh.x",mesh
rem delete the object
delete object id+1
rem reload the object
Load mesh "testmesh.x",mesh
rem mke the new object with mesh
make object id+1,mesh,0
rem do the CSG
PERFORM CSG DIFFERENCE id,id+1
rem delete +1 object
delete object id+1
rem make mesh from new object
make mesh from object mesh2,id
rem save the mesh file
if file exist("testmesh2.x")=1 then delete file "testmesh2.x"
save mesh "testmesh2.x",mesh2
rem delte the object to load load a new object mesh
delete object id
rem load the mesh
load mesh "testmesh2.x",mesh2
rem make the new object
make object id,mesh2,0
endfunction
function code
function make_object_disc(id,radius as float height as float)
if height>radius then EXIT PROMPT "Height larger than radius","Height Error":end
local mesh mesh2
mesh = 100000
mesh2 = 100001
rem make a square table
make object box id,radius,height,radius
rem cut out disc
make object cylinder id+1,-radius
make mesh from object mesh,id+1
rem save the mesh file
if file exist("testmesh.x")=1 then delete file "testmesh.x"
save mesh "testmesh.x",mesh
rem delete the object
delete object id+1
rem reload the object
Load mesh "testmesh.x",mesh
rem mke the new object with mesh
make object id+1,mesh,0
rem do the CSG
PERFORM CSG DIFFERENCE id,id+1
rem delete +1 object
delete object id+1
rem make mesh from new object
make mesh from object mesh2,id
rem save the mesh file
if file exist("testmesh2.x")=1 then delete file "testmesh2.x"
save mesh "testmesh2.x",mesh2
rem delte the object to load load a new object mesh
delete object id
rem load the mesh
load mesh "testmesh2.x",mesh2
rem make the new object
make object id,mesh2,0
endfunction
Edit
I think this a quicker and better way
Rem Project: makeholein object
Rem Created: 30/01/2009 17:49:00
Rem ***** Main Source File *****
sync on
sync rate 60
autocam off
position camera 0,10,-30
point camera 0,0,0
rem last value 0 = hole in box : 1 = disc
make_hole_in_object(1,5,0)
do
rotate object 1,x#,0,0
inc x#,.1
sync
loop
function make_hole_in_object(id,radius as float,out)
rem mesh numbers
mesh = 100000
rem cut out hole
make object cube id,radius
if out=0
make object cylinder id+1,radius
else
if out = 1
make object cylinder id+1,-radius
endif
endif
make mesh from object mesh,id+1
if file exist("mesh.x")=1 then delete file "mesh.x"
save mesh "mesh.x",mesh
delete object id+1
load object "mesh.x",id+1
perform csg difference id,id+1
delete object id+1
endfunction
Dark Physics makes any hot drink go cold.