RE: Completed Pioneer Models
Posted: Mon Dec 24, 2012 5:45 am
by fluffyfreak
This is what I have right now: define_model('test4_spacestation', {info = {bounding_radius=3000.0,materials = {'text', 'body', 'green_lens'},tags = {'orbital_station'},angular_velocity = 0.0,lod_pixels = { 3000, 0 },num_docking_ports = 4,dock_one_at_a_time_please = false,dock_anim_stage_duration = { DOCKING_TIMEOUT_SECONDS, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0 },undock_anim_stage_duration = { 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 20.0 },ship_dock_anim = function(port, stage, t, from, ship_aabb)local port_loc = {v(600,0,-600), v(600,0,600), v(-600,0,600), v(-600,0,-600)}-- dockingif stage == 2 thenreturn { port_loc[port] + vlerp(t, from, v(0,250,0)), v(1,0,0), v(0,0,1) }elseif stage == 3 thenreturn { port_loc[port] + from, v(1,0,0), v(0,0,1) }elseif stage == 4 thenreturn { port_loc[port] + vlerp(t, from, v(0,0,0)), v(1,0,0), v(0,0,1) }elseif stage == 5 thenreturn { port_loc[port] + vlerp(t, from, v(0,0,0)), v(-1,0,0), v(0,0,-1) }elseif stage == 6 or stage == 7 thenreturn { port_loc[port] + from, v(-1,0,0), v(0,0,-1) }elseif stage == 8 thenreturn { port_loc[port] + vlerp(t, from, v(0,200,0)), v(-1,0,0), v(0,0,-1) }elseif stage == 9 thenreturn { port_loc[port] + v(0,200,0), v(-1,0,0), v(0,0,-1) }end-- undockingif stage == -1 thenreturn { port_loc[port] + v(0,200,0), v(-1,0,0), v(0,0,-1) }elseif stage == -2 thenreturn { port_loc[port] + vlerp(t, from, v(0,0,0)), v(-1,0,0), v(0,0,-1) }elseif stage == -3 or stage == -4 or stage == -5 thenreturn { port_loc[port] + v(0,0,0), v(-1,0,0), v(0,0,-1) }elseif stage == -6 thenreturn { port_loc[port] + vlerp(t, from, v(0,250,0)), v(-1,0,0), v(0,0,-1) }elseif stage == -7 or stage == -8 thenreturn { port_loc[port] + v(0,250,0), v(-1,0,0), v(0,0,-1) }end-- note stage -9 returns nil. this means 'launch ship but continue space station-- animations'end,ship_approach_waypoints = function(port, stage)local port_loc = {v(600,0,-600), v(600,0,600), v(-600,0,600), v(-600,0,-600)}if stage == 1 thenreturn { port_loc[port] + v(0,4000,0), v(1,0,0), v(0,0,1) }elseif stage == 2 thenreturn { port_loc[port] + v(0,300,0), v(1,0,0), v(0,0,1) }endend,},static = function(lod)-- x = across-- y = along-- z = abovelocal port_loc = {v(600,0,-600), v(600,0,600), v(-600,0,600), v(-600,0,-600)}for i = 1,4 do-- front-- f7 f3 f6---- a b-- f4 d c f2---- f8 f1 f5local a = port_loc + v(-100,400,50)local b = port_loc + v(100,400,50)local c = port_loc + v(100,400,-50)local d = port_loc + v(-100,400,-50)local f1 = port_loc + v(0,400,-400)local f2 = port_loc + v(400,400,0)local f3 = port_loc + v(0,400,400)local f4 = port_loc + v(-400,400,0)local f5 = port_loc + v(400,0,-400)local f6 = port_loc + v(400,0,400)local f7 = port_loc[i] + v(-400,0,400)local f8 = port_loc[i] + v(-400,0,-400)-- back face pointslocal f1b = port_loc[i] + v(0,-400,-400)local f2b = port_loc[i] + v(400,-400,0)local f3b = port_loc[i] + v(0,-400,400)local f4b = port_loc[i] + v(-400,-400,0)set_material('text', 1.0,0.5,1.0,1)set_material('green_lens',0,1,0,.9,0,0,1,1)set_material('body', .5,.5,.5,1)use_material('body')--front face--door frame outsidetexture('ships/4_eagles/tex2.png', v(.5,.5,0), v(.01,0,0), v(0,0,.9))cuboid(port_loc[i] + v(-110,380.1,-59.5),v(220,25,10))--topcuboid(port_loc[i] + v(-110,380.1,49.5),v(220,25,10))--bottomcuboid(port_loc[i] + v(-110,380.1,-50),v(10.5,25,100))--leftcuboid(port_loc[i] + v(99.5,380.1,-50),v(10.5,25,100))--right--door frame insidetexture('ships/4_eagles/tex2.png', v(.5,.5,0), v(.005,0,0), v(0,.005,0))cuboid(port_loc[i] + v(-100,380.1,-49.5),v(200,24,.5))--topcuboid(port_loc[i] + v(-100,380.1,49),v(200,24,.5))--bottomtexture('ships/4_eagles/tex2.png', v(.5,.5,0), v(0,0,1), v(0,0.005,0))cuboid(port_loc[i] + v(-99.5,380.1,-50),v(.5,24,100))--leftcuboid(port_loc[i] + v(99.4,380.1,-50),v(.5,24,100))--righttexture('ships/4_eagles/tex12.png', v(.5,.5,0), v(.01,0,0), v(0,0,.9))tri(f1,d,c)xref_tri(f1,c,f2)xref_tri(f2,c,b)xref_tri(f2,b,f3)tri(f3,b,a)--pyramid sidesxref_tri(f2,f3,f6)xref_tri(f5,f1,f2)xref_tri(f6,f3b,f2b)xref_tri(f5,f2b,f1b)texture('ships/4_eagles/tex12.png', v(.5,.5,0), v(0,0,.9), v(0,.01,0))xref_quad(f2,f6,f2b,f5) -- sidestexture('ships/4_eagles/tex12.png', v(.5,.5,0), v(.01,0,0), v(0,.01,0))quad(f3,f7,f3b,f6) -- topquad(f5,f1b,f8,f1) -- bottomtexture('ships/4_eagles/tex12.png', v(.5,.5,0), v(.01,0,0), v(0,0,.9))quad(f1b,f2b,f3b,f4b) -- reartexture(nil)if i == 1 thencall_model('spacestation_entry1', port_loc[i] + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)elseif i == 2 thencall_model('spacestation_entry2', port_loc[i] + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)elseif i == 3 thencall_model('spacestation_entry3', port_loc[i] + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)elseif i == 4 thencall_model('spacestation_entry4', port_loc[i] + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)endendend}) Which has the snapping problem. The 'spacestation_entry4' functions are just clones of 'spacestation_entry1' with the DOCKING_BAY_# number changed and the name. EDIT - just deleted some commented code
RE: Completed Pioneer Models
Posted: Mon Dec 24, 2012 9:54 am
by fluffyfreak
Right this is the definition I've used and it seems to work: define_model('spacestation_entry2', {info = {bounding_radius = 200,materials = {'wall'}},static = function(lod)set_material('wall', .2,.2,.6,1)-- docking surfacegeomflag(0x11)invisible_tri(v(-100,-100,50), v(100,-100,50), v(100,-100,-50))invisible_tri(v(-100,-100,50), v(100,-100,-50), v(-100,-100,-50))geomflag(0)end,dynamic = function(lod)local stage = get_animation_stage('DOCKING_BAY_2')local pos = get_animation_position('DOCKING_BAY_2')if stage == 1 then-- open door at start of docking permissionpos = math.min(pos*50, 1.0)elseif stage == -8 then-- open doorelseif stage == 2 then-- close doorpos = 1.0 - poselseif stage == -9 then-- launch: close door after a little whilepos = 1.0 - poselsepos = 0endlocal door1 = vlerp(pos, v(0,-20,0), v(0,-20,-100))call_model('spacestation_door', door1, v(1,0,0), v(0,1,0), 1.0)if (stage >= 1 and stage <= 5) or (stage >= -9 and stage <= -5) thencall_model('spacestation_entry1_stage1', v(0,0,0), v(1,0,0), v(0,1,0), 1.0)endcall_model('spacestation_entry1_stage2', v(0,-300,0), v(1,0,0), v(0,1,0), 1.0)end})define_model('spacestation_entry3', {info = {bounding_radius = 200,materials = {'wall'}},static = function(lod)set_material('wall', .2,.2,.6,1)-- docking surfacegeomflag(0x12)invisible_tri(v(-100,-100,50), v(100,-100,50), v(100,-100,-50))invisible_tri(v(-100,-100,50), v(100,-100,-50), v(-100,-100,-50))geomflag(0)end,dynamic = function(lod)local stage = get_animation_stage('DOCKING_BAY_3')local pos = get_animation_position('DOCKING_BAY_3')if stage == 1 then-- open door at start of docking permissionpos = math.min(pos*50, 1.0)elseif stage == -8 then-- open doorelseif stage == 2 then-- close doorpos = 1.0 - poselseif stage == -9 then-- launch: close door after a little whilepos = 1.0 - poselsepos = 0endlocal door1 = vlerp(pos, v(0,-20,0), v(0,-20,-100))call_model('spacestation_door', door1, v(1,0,0), v(0,1,0), 1.0)if (stage >= 1 and stage <= 5) or (stage >= -9 and stage <= -5) thencall_model('spacestation_entry1_stage1', v(0,0,0), v(1,0,0), v(0,1,0), 1.0)endcall_model('spacestation_entry1_stage2', v(0,-300,0), v(1,0,0), v(0,1,0), 1.0)end})define_model('spacestation_entry4', {info = {bounding_radius = 200,materials = {'wall'}},static = function(lod)set_material('wall', .2,.2,.6,1)-- docking surfacegeomflag(0x13)invisible_tri(v(-100,-100,50), v(100,-100,50), v(100,-100,-50))invisible_tri(v(-100,-100,50), v(100,-100,-50), v(-100,-100,-50))geomflag(0)end,dynamic = function(lod)local stage = get_animation_stage('DOCKING_BAY_4')local pos = get_animation_position('DOCKING_BAY_4')if stage == 1 then-- open door at start of docking permissionpos = math.min(pos*50, 1.0)elseif stage == -8 then-- open doorelseif stage == 2 then-- close doorpos = 1.0 - poselseif stage == -9 then-- launch: close door after a little whilepos = 1.0 - poselsepos = 0endlocal door1 = vlerp(pos, v(0,-20,0), v(0,-20,-100))call_model('spacestation_door', door1, v(1,0,0), v(0,1,0), 1.0)if (stage >= 1 and stage <= 5) or (stage >= -9 and stage <= -5) thencall_model('spacestation_entry1_stage1', v(0,0,0), v(1,0,0), v(0,1,0), 1.0)endcall_model('spacestation_entry1_stage2', v(0,-300,0), v(1,0,0), v(0,1,0), 1.0)end})define_model('test4_spacestation', {info = {bounding_radius=3000.0,materials = {'text', 'body', 'green_lens'},tags = {'orbital_station'},angular_velocity = 0.0,lod_pixels = { 3000, 0 },num_docking_ports = 4,dock_one_at_a_time_please = false,dock_anim_stage_duration = { DOCKING_TIMEOUT_SECONDS, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0 },undock_anim_stage_duration = { 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 20.0 },ship_dock_anim = function(port, stage, t, from, ship_aabb)local port_loc = {v(600,0,-600), v(600,0,600), v(-600,0,600), v(-600,0,-600)}local port_pos = port_loc[port]-- dockingif stage == 2 thenreturn { vlerp(t, from, port_pos + v(0,250,0)), v(1,0,0), v(0,0,1) }elseif stage == 3 thenreturn { from, v(1,0,0), v(0,0,1) }elseif stage == 4 thenreturn { vlerp(t, from, port_pos + v(0,0,0)), v(1,0,0), v(0,0,1) }elseif stage == 5 thenreturn { vlerp(t, from, port_pos + v(0,0,0)), v(-1,0,0), v(0,0,-1) }elseif stage == 6 or stage == 7 thenreturn { from, v(-1,0,0), v(0,0,-1) }elseif stage == 8 thenreturn { vlerp(t, from, port_pos + v(0,200,0)), v(-1,0,0), v(0,0,-1) }elseif stage == 9 thenreturn { port_pos + v(0,200,0), v(-1,0,0), v(0,0,-1) }end-- undockingif stage == -1 thenreturn { port_pos + v(0,200,0), v(-1,0,0), v(0,0,-1) }elseif stage == -2 thenreturn { vlerp(t, from, port_pos + v(0,0,0)), v(-1,0,0), v(0,0,-1) }elseif stage == -3 or stage == -4 or stage == -5 thenreturn { port_pos + v(0,0,0), v(-1,0,0), v(0,0,-1) }elseif stage == -6 thenreturn { vlerp(t, from, port_pos + v(0,250,0)), v(-1,0,0), v(0,0,-1) }elseif stage == -7 or stage == -8 thenreturn { port_pos + v(0,250,0), v(-1,0,0), v(0,0,-1) }end-- note stage -9 returns nil. this means 'launch ship but continue space station-- animations'end,ship_approach_waypoints = function(port, stage)local port_loc = {v(600,0,-600), v(600,0,600), v(-600,0,600), v(-600,0,-600)}local port_pos = port_loc[port]if stage == 1 thenreturn { port_pos + v(0,4000,0), v(1,0,0), v(0,0,1) }elseif stage == 2 thenreturn { port_pos + v(0,300,0), v(1,0,0), v(0,0,1) }endend,},static = function(lod)-- x = across-- y = along-- z = abovelocal port_loc = {v(600,0,-600), v(600,0,600), v(-600,0,600), v(-600,0,-600)}for i = 1,4 dolocal port_pos = port_loc
-- front-- f7 f3 f6---- a b-- f4 d c f2---- f8 f1 f5local a = port_pos + v(-100,400,50)local b = port_pos + v(100,400,50)local c = port_pos + v(100,400,-50)local d = port_pos + v(-100,400,-50)local f1 = port_pos + v(0,400,-400)local f2 = port_pos + v(400,400,0)local f3 = port_pos + v(0,400,400)local f4 = port_pos + v(-400,400,0)local f5 = port_pos + v(400,0,-400)local f6 = port_pos + v(400,0,400)local f7 = port_pos + v(-400,0,400)local f8 = port_pos + v(-400,0,-400)-- back face pointslocal f1b = port_pos + v(0,-400,-400)local f2b = port_pos + v(400,-400,0)local f3b = port_pos + v(0,-400,400)local f4b = port_pos + v(-400,-400,0)set_material('text', 1.0,0.5,1.0,1)set_material('green_lens',0,1,0,.9,0,0,1,1)set_material('body', .5,.5,.5,1)use_material('body')--front face--door frame outsidetexture('ships/4_eagles/tex2.png', v(.5,.5,0), v(.01,0,0), v(0,0,.9))cuboid(port_pos + v(-110,380.1,-59.5),v(220,25,10))--topcuboid(port_pos + v(-110,380.1,49.5),v(220,25,10))--bottomcuboid(port_pos + v(-110,380.1,-50),v(10.5,25,100))--leftcuboid(port_pos + v(99.5,380.1,-50),v(10.5,25,100))--right--door frame insidetexture('ships/4_eagles/tex2.png', v(.5,.5,0), v(.005,0,0), v(0,.005,0))cuboid(port_pos + v(-100,380.1,-49.5),v(200,24,.5))--topcuboid(port_pos + v(-100,380.1,49),v(200,24,.5))--bottomtexture('ships/4_eagles/tex2.png', v(.5,.5,0), v(0,0,1), v(0,0.005,0))cuboid(port_pos + v(-99.5,380.1,-50),v(.5,24,100))--leftcuboid(port_pos + v(99.4,380.1,-50),v(.5,24,100))--righttexture('ships/4_eagles/tex12.png', v(.5,.5,0), v(.01,0,0), v(0,0,.9))tri(f1,d,c)xref_tri(f1,c,f2)xref_tri(f2,c,b)xref_tri(f2,b,f3)tri(f3,b,a)--pyramid sidesxref_tri(f2,f3,f6)xref_tri(f5,f1,f2)xref_tri(f6,f3b,f2b)xref_tri(f5,f2b,f1b)texture('ships/4_eagles/tex12.png', v(.5,.5,0), v(0,0,.9), v(0,.01,0))xref_quad(f2,f6,f2b,f5) -- sidestexture('ships/4_eagles/tex12.png', v(.5,.5,0), v(.01,0,0), v(0,.01,0))quad(f3,f7,f3b,f6) -- topquad(f5,f1b,f8,f1) -- bottomtexture('ships/4_eagles/tex12.png', v(.5,.5,0), v(.01,0,0), v(0,0,.9))quad(f1b,f2b,f3b,f4b) -- reartexture(nil)if i == 1 thencall_model('spacestation_entry1', port_pos + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)elseif i == 2 thencall_model('spacestation_entry2', port_pos + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)elseif i == 3 thencall_model('spacestation_entry3', port_pos + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)elseif i == 4 thencall_model('spacestation_entry4', port_pos + v(0,400,0), v(1,0,0), v(0,1,0), 1.0)endendend}) Just for completeness sake anyway
Gives me something to test with.