home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////////////////
- // Robot (Baby making factory animation)
- // Robert Stewart
- // (see factory.sxt)
- /////////////////////////////////////
-
- ROBOTBASE = 0
- ROBOTARM = deg 50
- ROBOTELBOW = deg 140
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -10
- ROBOTGRAB = deg -5
-
- shift y,-100
- shift z,500
- rotate y,deg -45
-
- call animate1: 0
-
- shift y,600
- lite = new light
-
- position 0,200,0
- direction 200,100,600
- set camera
-
- render mode RENDER_QUICK
- return
-
- ///////////////////////////////// base
-
- initialize:
- ROBOTBASE = 0
- ROBOTARM = deg 40
- ROBOTELBOW = deg 180
- ROBOTWRIST = deg 180
- ROBOTWIST = 0
- ROBOTGRAB = 0
-
- draw:
- res = 6
- mat = new material color 120,150,168
- mat.diffusion = 0.5
- mat.specularity = 5
- mat.shininess = 50
- mat.smoothness = deg 80
- robot_mesh = new list
- call BOX
- call BASE
- call SHOULDER
- call BICEP
- call ELBOW
- call TENDON
- call FOREARM
- call WRIST
-
- animate1: time
- position 300,0,740
-
- if time == 0
- call initialize
-
- else if time <= 0.6
- ROBOTBASE = time * deg -90/0.6
- ROBOTARM = deg 40
- ROBOTELBOW = deg 180
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90*time/0.6
- ROBOTGRAB = 0
-
- else if time <= 1
- ROBOTBASE = deg -90
- ROBOTARM = deg 40 - deg -60*(time-0.6)/0.4
- ROBOTELBOW = deg 180
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -40*(time-0.6)/0.4
-
- else if time <= 1.6
- ROBOTBASE = deg -90
- if time < 1.3
- ROBOTARM = -deg -100 + deg -58*(time-1)/0.3
- ROBOTELBOW = deg 180 + deg -35*(time-1)/0.3
- else
- ROBOTARM = deg 42
- ROBOTELBOW = deg 145 + deg -55*(time-1.3)/0.3
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -5
-
- else if time <= 2.2
- ROBOTBASE = deg -90 + (time-1.6) * deg 90 / 0.6
- ROBOTARM = deg 42
- ROBOTELBOW = -deg -90
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -5
-
- else
- ROBOTBASE = 0
- ROBOTARM = deg 42
- ROBOTELBOW = -deg -90
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- if time <= 2.5
- ROBOTGRAB = deg -5+(time-2.2) * deg -20
- else
- ROBOTGRAB = deg 11
-
- %ROBOTBASE = ROBOTBASE
- %ROBOTWIST = ROBOTWIST
- call draw
-
- animate2: time
- position 300,0,420
-
- if time <= 0.8
- call initialize
-
- else if time <= 1.4
- ROBOTBASE = (time-0.8) * deg -90/0.6
- ROBOTARM = deg 40
- ROBOTELBOW = deg 180
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90*(time-0.8)/0.6
- ROBOTGRAB = 0
-
- else if time <= 1.8
- ROBOTBASE = deg -90
- ROBOTARM = deg 40 - deg -60*(time-1.4)/0.4
- ROBOTELBOW = deg 180
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -45 * (time-1.4)/0.4 - deg -5
-
- else if time <= 2.4
- ROBOTBASE = deg -90
- if time < 2.1
- ROBOTARM = -deg -100 + deg -58*(time-1.8)/0.3
- ROBOTELBOW = deg 180 + deg -20*(time-1.8)/0.3
- else
- ROBOTARM = deg 42
- ROBOTELBOW = deg 127 + deg -70*(time-2.1)/0.3
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -10
-
- else if time <= 3
- ROBOTBASE = deg -90 - (time-2.4) * deg -90/0.6
- ROBOTARM = deg 42
- ROBOTELBOW = -deg -90
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -10
-
- else if time <= 3.6
- M = (time-3) / 0.6
- ROBOTBASE = 0
- ROBOTARM = deg 42 + deg 2 * M
- ROBOTELBOW = deg 90 + deg 16 * M
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90 + 2*PI * M
- ROBOTGRAB = deg -10
-
- else if time <= 4
- M = (time-3.6) / 0.4
- ROBOTBASE = 0
- ROBOTARM = deg 42 + deg 2 * (1-M)
- ROBOTELBOW = -deg -90 + deg 16 * (1-M)
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -10 + deg -10 * M
- else
- ROBOTBASE = 0
- ROBOTARM = deg 42
- ROBOTELBOW = -deg -90
- ROBOTWRIST = deg 180
- ROBOTWIST = deg -90
- ROBOTGRAB = deg -20
-
- %ROBOTBASE = ROBOTBASE
- %ROBOTWIST = ROBOTWIST
- call draw
-
-
- ////////////////////////////////// base
-
- BOX:
- mesh m: x,y,z = -50,0,-50 to 50,-100,50 div 1,1,1 material mat
- robot_mesh add m
-
- BASE:
- call make_cylinder_y: 0,0,0,10,50,50
- rotate y,ROBOTBASE
- call make_cylinder_y: 10,0,0,20,50,30
- call make_cylinder_y: 30,0,0,10,30,30
- call make_disk_xz: 0,40,0,30
-
- SHOULDER:
- shift y,40
- rotate y,ROBOTBASE
-
- mesh m: x,z = -20,10 to 20,20 div res,1 material mat
- y = (1+x/20)*(1-x/20)*90
- robot_mesh add m
-
- mesh m: x,h = -20,0 to 20,1 div res,1 material mat
- y = h*(1+x/20)*(1-x/20)*90
- robot_mesh add m
-
- mesh m: x,z = -20,-10 to 20,-20 div res,1 material mat
- y = (1+x/20)*(1-x/20)*90
- robot_mesh add m
-
- mesh m: x,h = -20,0 to 20,1 div res,1 material mat
- y = h*(1+x/20)*(1-x/20)*90
- robot_mesh add m
-
- ////////////////////////////////// Bicep
-
- BICEP:
- shift y,100
- rotate y,ROBOTBASE
- call make_disk_xy: 0,0,-30,6
- call make_cylinder_z: -30,0,0,60,6,6
- call make_disk_xy: 0,0,30,6
- rotate z,ROBOTARM
- call make_cylinder_y: 0,0,0,150,6,6
- shift y,150
- XELBOW,YELBOW,ZELBOW = get position
-
- ELBOW:
- shift y,100
- rotate y,ROBOTBASE
- rotate z,ROBOTARM
- shift y,150
- call make_disk_xy: 0,0,-10,10
- call make_cylinder_z: -10,0,0,20,10,10
- call make_disk_xy: 0,0,10,10
- call make_disk_xy: 0,0,-12,4
- call make_cylinder_z: -12,0,0,24,4,4
- call make_disk_xy: 0,0,12,4
-
- TENDON:
- shift y,55
- rotate y,ROBOTBASE
- call TENDERJOINT
- call CARTONE
- a,b,c = get position
- position XELBOW,YELBOW,ZELBOW
- direction a,b,c
- call make_cylinder_z: 0,0,0,150,3,3
-
- TENDERJOINT:
- call make_disk_xy: 0,0,-30,4
- call make_cylinder_z: -30,0,0,60,4,4
- call make_disk_xy: 0,0,30,4
-
- CARTONE:
- direction XELBOW,YELBOW,ZELBOW
- call make_cylinder_z: 0,0,0,60,8,8
-
- ////////////////////////////////// Forearm
-
- FOREARM:
- shift y,100
- rotate y,ROBOTBASE
- x,y = angle ROBOTARM + deg 90 radius 150
- shift x,x
- shift y,y
- rotate z,ROBOTELBOW
- call make_cylinder_y: 0,0,0,100,5,5
-
- WRIST:
- shift y,100
- rotate y,ROBOTBASE
- x,y = angle ROBOTARM + deg 90 radius 150
- shift x,x
- shift y,y
- x,y = angle ROBOTELBOW + deg 90 radius 100
- shift x,x
- shift y,y
- call make_disk_xy: 0,0,-8,8
- call make_cylinder_z: -8,0,0,16,8,8
- call make_disk_xy: 0,0,8,8
-
- call make_disk_xy: 0,0,-10,4
- call make_cylinder_z: -10,0,0,20,4,4
- call make_disk_xy: 0,0,10,4
-
- rotate z,ROBOTWRIST
- call make_cylinder_y: 0,0,0,25,5,5
- shift y,25
- rotate y,ROBOTWIST
- //
- call make_disk_xy: 0,0,-8,8
- call make_cylinder_z: -8,0,0,16,8,8
- call make_disk_xy: 0,0,8,8
- //
- call make_disk_xy: 0,0,-10,4
- call make_cylinder_z: -10,0,0,20,4,4
- call make_disk_xy: 0,0,10,4
- call PINCHA
- call PINCHB
- call PINCHC
-
- PINCHA:
- rotate z, deg -60 + ROBOTGRAB
- call make_cylinder_y: 0,0,0,25,5,4
- shift y,25
- rotate z, deg 60 + ROBOTGRAB
- call make_sphere: 0,0,0,4
- call make_cylinder_y: 0,0,0,20,4,3
- shift y,20
- rotate z, deg 60 + ROBOTGRAB
- call make_sphere: 0,0,0,3
- call make_cylinder_y: 0,0,0,15,3,2
- shift y,15
- call make_sphere: 0,0,0,2
-
- PINCHB:
- rotate z, deg 60 - ROBOTGRAB
- call make_cylinder_y: 0,0,0,25,5,4
- shift y,25
- rotate z, deg -60 - ROBOTGRAB
- call make_sphere: 0,0,0,4
- call make_cylinder_y: 0,0,0,20,4,3
- shift y,20
- rotate z, deg -60 - ROBOTGRAB
- call make_sphere: 0,0,0,3
- call make_cylinder_y: 0,0,0,15,3,2
- shift y,15
- call make_sphere: 0,0,0,2
-
- PINCHC:
- shift y,40
- A,B,C = get position
- %PINX = A
- %PINY = B
- %PINZ = C
-
- ////////////////////////////////////// sphere
-
- make_sphere: x,y,z,r
- position x,y,z mode POS_RELATIVE
- mesh m: p,q = -PI_2,-PI to PI_2,PI div res/2,res material mat
- x,y,z = angle p,q radius r
- robot_mesh add m
-
- ////////////////////////////////////// cylinder y
-
- make_cylinder_y: y,x,z,d,u,v
- position x,y,z mode POS_RELATIVE
- mesh m: y,q = 0,-PI to d,PI div 1,res material mat
- r = u + y*(v-u)/d
- x,z = angle q radius r
- robot_mesh add m
-
- ////////////////////////////////////// cylinder z
-
- make_cylinder_z: z,x,y,d,u,v
- position x,y,z mode POS_RELATIVE
- mesh m: z,q = 0,-PI to d,PI div 1,res material mat
- r = u + z*(v-u)/d
- x,y = angle q radius r
- robot_mesh add m
-
- ////////////////////////////////////// disk xy
-
- make_disk_xy: x,y,z,r
- z = 0
- position x,y,z mode POS_RELATIVE
- mesh m: a,b = 0,-PI to r,PI div 1,res material mat
- x,y = angle b radius a
- robot_mesh add m
-
- ////////////////////////////////////// disk xz
-
- make_disk_xz: x,y,z,r
- y = 0
- position x,y,z mode POS_RELATIVE
- mesh m: a,b = 0,-PI to r,PI div 1,res material mat
- x,z = angle b radius a
- robot_mesh add m
-
- //////////////////////////////////
- ////////////////////////
-