@name BB-8
@inputs 
@outputs 
@persist 
@trigger 
@model models/XQM/Rails/gumball_1.mdl
interval(50)

if (first()) {
    Scale = vec(2.5,2.5,2.5)
    
    entity():setColor(vec4(0))
    
    holoCreate(1)
    holoModel(1,"hq_sphere")
    holoScale(1,Scale)
    holoParent(1,entity())
    
    holoClipEnabled(1,1,1)
    holoClip(1,vec(0,0,12),vec(0,0,-1),0)
    
    holoClipEnabled(1,2,1)
    holoClip(1,2,vec(0,0,-12),vec(0,0,1),0)
    
    holoClipEnabled(1,3,1)
    holoClip(1,3,vec(0,-12,0),vec(0,1,0),0)
    
    holoClipEnabled(1,4,1)
    holoClip(1,4,vec(0,12,0),vec(0,-1,0),0)
    
    holoClipEnabled(1,5,1)
    holoClip(1,5,vec(12,0,0),vec(-1,0,0),0)
    
    holoClipEnabled(1,6,1)
    holoClip(1,6,vec(-12,0,1),vec(1,0,0),0)
    
    holoCreate(2)
    holoModel(2,"hq_sphere")
    holoScale(2,Scale)
    holoColor(2,vec(255,115,46))
    holoParent(2,entity())
    
    holoClipEnabled(2,1,1)
    holoClip(2,vec(0,0,13),vec(0,0,-1),0)
    
    holoClipEnabled(2,2,1)
    holoClip(2,2,vec(0,0,12),vec(0,0,1),0)
    
    holoCreate(3)
    holoModel(3,"hq_sphere")
    holoScale(3,Scale)
    holoColor(3,vec(255,115,46))
    holoParent(3,entity())
    
    holoClipEnabled(3,1,1)
    holoClip(3,vec(0,0,-13),vec(0,0,1),0)
    
    holoClipEnabled(3,2,1)
    holoClip(3,2,vec(0,0,-12),vec(0,0,-1),0)
    
    holoCreate(4)
    holoModel(4,"hq_sphere")
    holoScale(4,Scale)
    holoColor(4,vec(255,115,46))
    holoParent(4,entity())
    
    holoClipEnabled(4,1,1)
    holoClip(4,vec(0,-13,0),vec(0,1,0),0)
    
    holoClipEnabled(4,2,1)
    holoClip(4,2,vec(0,-12,0),vec(0,-1,0),0)
    
    holoCreate(5)
    holoModel(5,"hq_sphere")
    holoScale(5,Scale)
    holoColor(5,vec(255,115,46))
    holoParent(5,entity())
    
    holoClipEnabled(5,1,1)
    holoClip(5,vec(0,13,0),vec(0,-1,0),0)
    
    holoClipEnabled(5,2,1)
    holoClip(5,2,vec(0,12,0),vec(0,1,0),0)
    
    holoCreate(6)
    holoModel(6,"hq_sphere")
    holoScale(6,Scale)
    holoColor(6,vec(255,115,46))
    holoParent(6,entity())
    
    holoClipEnabled(6,1,1)
    holoClip(6,vec(13,0,0),vec(-1,0,0),0)
    
    holoClipEnabled(6,2,1)
    holoClip(6,2,vec(12,0,0),vec(1,0,0),0)
    
    holoCreate(7)
    holoModel(7,"hq_sphere")
    holoScale(7,Scale)
    holoColor(7,vec(255,115,46))
    holoParent(7,entity())
    
    holoClipEnabled(7,1,1)
    holoClip(7,vec(-13,0,0),vec(1,0,0),0)
    
    holoClipEnabled(7,2,1)
    holoClip(7,2,vec(-12,0,0),vec(-1,0,0),0)
    
    holoCreate(8)
    holoModel(8,"hq_sphere")
    holoScale(8,Scale)
    holoParent(8,entity())
    
    holoClipEnabled(8,1,1)
    holoClip(8,vec(0,0,13),vec(0,0,1),0)
    
    holoCreate(9)
    holoModel(9,"hq_sphere")
    holoScale(9,Scale)
    holoParent(9,entity())
    
    holoClipEnabled(9,1,1)
    holoClip(9,vec(0,0,-13),vec(0,0,-1),0)
    
    holoCreate(10)
    holoModel(10,"hq_sphere")
    holoScale(10,Scale)
    holoParent(10,entity())
    
    holoClipEnabled(10,1,1)
    holoClip(10,vec(0,-13,0),vec(0,-1,0),0)
    
    holoCreate(11)
    holoModel(11,"hq_sphere")
    holoScale(11,Scale)
    holoParent(11,entity())
    
    holoClipEnabled(11,1,1)
    holoClip(11,vec(0,13,0),vec(0,1,0),0)
    
    holoCreate(12)
    holoModel(12,"hq_sphere")
    holoScale(12,Scale)
    holoParent(12,entity())
    
    holoClipEnabled(12,1,1)
    holoClip(12,vec(13,0,0),vec(1,0,0),0)
    
    holoCreate(13)
    holoModel(13,"hq_sphere")
    holoScale(13,Scale)
    holoParent(13,entity())
    
    holoClipEnabled(13,1,1)
    holoClip(13,vec(-13,0,0),vec(-1,0,0),0)
    
    holoCreate(14)
    holoModel(14,"hq_sphere")
    holoPos(14,entity():toWorld(vec(0,0,14)))
    holoScale(14,vec(1.5,1.5,1.5))
    holoParent(14,entity())
    
    holoClipEnabled(14,1,1)
    holoClip(14,vec(0,0,1),vec(0,0,1),0)
    
    holoClipEnabled(14,2,1)
    holoClip(14,2,vec(0,0,6),vec(0,0,-1),0)
    
    holoCreate(15)
    holoModel(15,"hq_sphere")
    holoPos(15,entity():toWorld(vec(0,0,14)))
    holoScale(15,vec(1.5,1.5,1.5))
    holoColor(15,vec(255,115,46))
    holoParent(15,14)
    
    holoClipEnabled(15,1,1)
    holoClip(15,vec(0,0,6),vec(0,0,1),0)
    
    holoClipEnabled(15,2,1)
    holoClip(15,2,vec(0,0,7),vec(0,0,-1),0)
    
    holoCreate(16)
    holoModel(16,"hq_sphere")
    holoPos(16,entity():toWorld(vec(0,0,14)))
    holoScale(16,vec(1.5,1.5,1.5))
    holoParent(16,14)
    
    holoClipEnabled(16,1,1)
    holoClip(16,vec(0,0,7),vec(0,0,1),0)
    
    holoCreate(17)
    holoModel(17,"hq_sphere")
    holoPos(17,entity():toWorld(vec(0,0,14.9)))
    holoScale(17,vec(1.49,1.49,0.5))
    holoParent(17,14)
    
    holoCreate(18)
    holoModel(18,"hq_tube_thin")
    holoPos(18,entity():toWorld(vec(-6.5,0,17.2)))
    holoAng(18,entity():toWorld(ang(0,90,117)))
    holoScale(18,vec(0.3,0.3,0.3))
    holoParent(18,14)
    
    holoCreate(19)
    holoModel(19,"hq_sphere")
    holoPos(19,entity():toWorld(vec(-7.5,0,17.7)))
    holoScale(19,vec(0.3,0.3,0.3))
    holoColor(19,vec(0))
    holoParent(19,14)
    
    holoCreate(20)
    holoModel(20,"hq_tube")
    holoPos(20,entity():toWorld(vec(-6.6,-3,16)))
    holoAng(20,entity():toWorld(ang(0,115,108)))
    holoScale(20,vec(0.25,0.25,0.25))
    holoColor(20,vec(68))
    holoParent(20,14)
    
    holoCreate(21)
    holoModel(21,"hq_sphere")
    holoPos(21,entity():toWorld(vec(-6.8,-3.1,16.1)))
    holoScale(21,vec(0.25,0.25,0.25))
    holoColor(21,vec(0))
    holoParent(21,14)
    
    holoCreate(22)
    holoModel(22,"hq_cylinder")
    holoPos(22,entity():toWorld(vec(0,-1,25)))
    holoScale(22,vec(0.03,0.03,1))
    holoColor(22,vec(86))
    holoParent(22,14)
    
    holoCreate(23)
    holoModel(23,"hq_cylinder")
    holoPos(23,entity():toWorld(vec(0,0,25)))
    holoScale(23,vec(0.03,0.03,0.5))
    holoColor(23,vec(86))
    holoParent(23,14)
}

holoPos(14,entity():pos()+vec(0,0,14))
holoAng(14,owner():toWorld(ang(0,0,0)))
applyForce((owner():pos()+vec(-70,0,0)-entity():massCenter())*30-entity():vel()*entity():mass())
