It's no good, I've tried lots of ways to make this into a ball, and now it's currently spiky...
Here's the code so far. Can anyone make this into a ball where all of the sphere are on X/Y/Z coordinates divisible by 0.03 close together, and not overlapping? It can be a ball, or 3D hexagon stacking, that doesn't matter so long as the first shape is repeated...
Set Display Mode 1024,768,32
autocam off
backdrop off
sync on
set normalization on
set ambient light 20
hide mouse
load image "Background.png",1
load image "Blue.png",2
hide light 0
make light 1
set light range 1,300
wait 500
Origin# = 0.06
Glow = 12
Glow1 = 0
fov = 12
set camera fov fov
`I add an outer boundary to the universe because of my slow computer.
UniverseScale = 1000
Particles = 17
`I also need to Limit the maximun number of particles because of computer speed.
`limit = 18 is OK
`Limit 100 not easy to get right
limit = 100
`Total is just the first particle number, and it's 3 because of some fake boundary particles.
total = 3
`Setup routines, not part of main program...
set camera range 0.1,3000
make object sphere 1,3000,6,6
set object 1,1,1,0,1,1,1,1
Texture object 1,1
position camera 0,0,-5
set alpha mapping on 1,95
`Loop that jumps to Generates first shape
Gosub Generate
count = 0
Do
if Particles < Limit and glow1 = 0
Origin# = PA#
`Clone the initial shape
gosub clone
Endif
If particles >= limit
glow1 = 1
Endif
if glow1 = 1
Gosub Animate
endif
`gosub animate
gosub PositionCamera
position object 1,camera position x(0),camera position y(0),camera position z(0)
position light 1,camera position x(0),camera position y(0),camera position z(0)
sync
Loop
Clone:
`The loop that shapes Spacetime
PA# = PA# + 0.06
NA# = PA# - (PA# * 2.0)
PB# = PA#/2.0
NB# = NA#/2.0
PC# = PB#/2.0
NC# = NB#/2.0
inc total,14
OriginX# = PA#-Origin#
OriginY# = NA# + Origin#
OriginZ# = PB# - (origin#/2.0)
inc particles
instance object particles,6
position object particles,NB#+OriginX#,PA#+OriginY#,0+OriginZ#
inc particles
instance object particles,6
position object Particles, PB#+OriginX#,NA#+OriginY#,0+OriginZ#
inc particles
instance object particles,6
position object particles,NA#+OriginX#,0+OriginY#,0+OriginZ#
inc particles
instance object particles,6
position object particles,PA#+OriginX#,0+OriginY#,0+OriginZ#
inc particles
instance object particles,6
position object particles,NB#+OriginX#,NA#+OriginY#,0+OriginZ#
inc particles
instance object particles,6
position object particles,PB#+OriginX#,PA#+OriginY#,0+OriginZ#
inc particles
instance object particles,6
position object particles,PC#+OriginX#,PB#+OriginY#,PA#+OriginZ#
inc particles
instance object particles,6
position object particles,NC#+OriginX#,NB#+OriginY#,NA#+OriginZ#
inc particles
instance object particles,6
position object particles,NB#+OriginX#,0+OriginY#,PA#+OriginZ#
inc particles
instance object particles,6
position object particles,PB#+OriginX#,0+OriginY#,NA#+OriginZ#
inc particles
instance object particles,6
position object particles,PC#+OriginX#,NB#+OriginY#,PA#+OriginZ#
inc particles
instance object particles,6
position object particles,NC#+OriginX#,PB#+OriginY#,NA#+OriginZ#
Return
Generate:
`The loop that creates the Universe. How small can I get it?
`Add as many particles as a computer can allow based on the speed of the computer
`This setup is currently far more Hard Coded than I want it to be
`I want the maths to be naturally occuring in the universe, so everything uses the number 6
`The Number 6 in this case 0.6 is divided to represent Hexidecimal in Decimal
PA# = 0.06
NA# = PA# - (PA# * 2.0)
PB# = PA#/2.0
NB# = NA#/2.0
PC# = PB#/2.0
NC# = NB#/2.0
inc total,14
OriginX# = PA#-Origin#
OriginY# = NA# + Origin#
OriginZ# = PB# - (origin#/2.0)
make OBJECT sphere total,0.06,6,6
make OBJECT sphere total-13,0.21
make OBJECT sphere 6, 0.06,6,6
set object 6,1,1,1,1,1,1,0
color object 6,rgb(10,10,90)
position mouse screen width()/2,screen height()/2
position object total-13,0+OriginX#,0+OriginY#,0+OriginZ#
make mesh from object 1, total
`These Hard Coded positions look like they can be reduced to a single loop
add limb 6,1,1
add limb 6,2,1
add limb 6,3,1
add limb 6,4,1
add limb 6,5,1
add limb 6,6,1
add limb 6,7,1
add limb 6,8,1
add limb 6,9,1
add limb 6,10,1
add limb 6,11,1
add limb 6,12,1
add limb 6,13,1
offset limb 6,1,NB#+OriginX#,PA#+OriginY#,0+OriginZ#
offset limb 6,2,PB#+OriginX#,NA#+OriginY#,0+OriginZ#
offset limb 6,3,NA#+OriginX#,0+OriginY#,0+OriginZ#
offset limb 6,4,PA#+OriginX#,0+OriginY#,0+OriginZ#
offset limb 6,5,NB#+OriginX#,NA#+OriginY#,0+OriginZ#
offset limb 6,6,PB#+OriginX#,PA#+OriginY#,0+OriginZ#
offset limb 6,7,PC#+OriginX#,PB#+OriginY#,PA#+OriginZ#
offset limb 6,8,NC#+OriginX#,NB#+OriginY#,NA#+OriginZ#
offset limb 6,9,NB#+OriginX#,0+OriginY#,PA#+OriginZ#
offset limb 6,10,PB#+OriginX#,0+OriginY#,NA#+OriginZ#
offset limb 6,11,PC#+OriginX#,NB#+OriginY#,PA#+OriginZ#
offset limb 6,12,NC#+OriginX#,PB#+OriginY#,NA#+OriginZ#
color limb 6,13,rgb(0,0,0)
for n = 1 to 12
color limb 6,n,rgb(0,0,50)
next n
set alpha mapping on 6,10
SET OBJECT TRANSPARENCY 6,6
delete object total
delete object total-13
hide object 6
Return
Animate:
`GlowTest just illuminates the path of energy
if t <= timer()
t = timer() + 50
if on = 0
color limb 6,glow,rgb(200,200,255)
On = 1
Endif
if on = 2
color limb 6,glow,rgb(0,0,90)
set alpha mapping on 6,10
SET OBJECT TRANSPARENCY 6,6
Dec Glow
If Glow = 0
inc total,14
glow = 12
if total = particles+14 then total = 17
endif
On = 0
Endif
if on = 1 then on = 2
endif
Return
positionCamera:
control camera using arrowkeys 0,0.00001*((200-fov)/2),0.0001*((200-fov)/2)
if leftkey() then move camera left 0.000001*((200-fov)/2)
if rightkey() then move camera right 0.000001*((200-fov)/2)
if keystate(17) = 1
if smoothcamera = 0
smoothcamera = 1
else
smoothcamera = 0
endif
repeat until keystate(17) = 0
endif
smoothcamx# = ( smoothcamx# + mousemovey() )
smoothcamy# = ( smoothcamy# + mousemovex() )
xrotate camera ( camera angle x() + ( smoothcamx# - camera angle x() ) / 50.0 )
yrotate camera ( camera angle y() + ( smoothcamy#/50 - camera angle y() ) / 150.0 )
return
