Ive been trying to add some landing gear but I'm messing it up somewhere along the line, I would very much appreciate it if someone could look at this:EDIT// Managed to fix (I think) the landing gear.
Code:
define_model('dg', { info = {scale = 9.00,bounding_radius = 30,materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},},static = function(lod) set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)set_material('color1', .35,.1,.15,1,1,.85,.9,100) set_material('color2', .15,.1,.35,1,.90,.85,1,100) set_material('grey', .3,.3,.3,1,.3,.3,.3,10) set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)use_material('courier')texture('delta.png') load_obj('delta2.obj') end })define_model('nosewheel', {info = {lod_pixels={5,50,0},bounding_radius = 7,materials={'leg','tyre'}},static = function(lod)set_material('leg', .5, .5, .5, 1, .5, .5, .5, 2.0, 0, 0, 0)set_material('tyre', .3, .3, .3, 1, 0,0,0, 1, 0, 0, 0)use_material('leg')local v6 = v(0, 0, 0)local v7 = v(0, 3, 0)local v8 = v(0, 5, 0)local divs = lod*4cylinder(divs, v6, v8, v(0,0,1), .4)cylinder(divs, v7, v8, v(0,0,1), .5)use_material('tyre')xref_cylinder(divs, v(.5,5,0), v(1,5,0), v(0,0,1), 1.0)end})define_model('nosewheelunit', {info = {bounding_radius = 7,materials={'inside', 'matvar2'}},static = function(lod)set_material('inside', .2,.2,.2,1, 0,0,0, 1, 0,0,0)end,dynamic = function(lod)-- flapslocal v6 = v(1.5, 0, 6)local v7 = v(1.5, 0, -1)local v8 = v(0, 0, 6)local v9 = v(0, 0, -1)set_material('matvar2', get_arg_material(2))use_material('inside')zbias(1, v(0,0,0), v(0,1,0))-- flap internalxref_quad(v8, v6, v7, v9)-- SHould use parameter material(2) here but param materials not done yetuse_material('matvar2')local flap_ang = 0.5*math.pi*math.clamp(3*get_arg(0),0,1)local wheel_ang = 0.5*math.pi*math.clamp(1.5*(get_arg(0)-0.34), 0, 1)local vrot = 1.5*v(-math.cos(flap_ang), math.sin(flap_ang), 0)xref_quad(v7, v6, v6+vrot, v7+vrot)xref_quad(v7, v7+vrot, v6+vrot, v6)call_model('nosewheel', v(0,0,0), v(1,0,0),v(0,math.sin(wheel_ang),math.cos(wheel_ang)), 1.0)zbias(0)end})define_model('mainwheel', {info = {lod_pixels = {5,50,0},bounding_radius = 8,materials = {'leg', 'tyre'}},static = function(lod)local v6 = v(0,0,0)local v7 = v(0,3,0)local v8 = v(0,5,0)-- crossbarlocal v13 = v(0, 5, 1.4)local v14 = v(0, 5, -1.4)local divs = 4*lodset_material('leg', .5,.5,.5,1, 1,1,1, 2, 0,0,0)use_material('leg')cylinder(divs, v6, v8, v(0,0,1), .4)cylinder(divs, v7, v8, v(0,0,1), .5)cylinder(4, v13, v14, v(1,0,0), .5)set_material('tyre', .3,.3,.3,1, 0,0,0, 1, 0,0,0)use_material('tyre')xref_cylinder(divs, v(.5, 5, 1.1), v(1, 5, 1.1), v(0,0,1), 1)xref_cylinder(divs, v(.5, 5, -1.1), v(1, 5, -1.1), v(0,0,1), 1)end})define_model('mainwheelunit', {info = {bounding_radius = 7,materials={'inside','matvar2'}},static = function(lod)set_material('inside', .2,.2,.2,1, 0,0,0, 1, 0,0,0)end,dynamic = function(lod)-- flapslocal v6 = v(1.5, 0, 6)local v7 = v(1.5, 0, -1)local v8 = v(0, 0, 6)local v9 = v(0, 0, -1)set_material('matvar2', get_arg_material(2))use_material('inside')zbias(1, v(0,0,0), v(0,1,0))-- flap internalxref_quad(v8, v6, v7, v9)-- SHould use parameter material(2) here but param materials not done yetuse_material('matvar2')local flap_ang = 0.5*math.pi*math.clamp(3*get_arg(0),0,1)local wheel_ang = 0.5*math.pi*math.clamp(1.5*(get_arg(0)-0.34), 0, 1)local vrot = 1.5*v(-math.cos(flap_ang), math.sin(flap_ang), 0)xref_quad(v7, v6, v6+vrot, v7+vrot)xref_quad(v7, v7+vrot, v6+vrot, v6)call_model('mainwheel', v(0,0,0), v(1,0,0),v(0,math.sin(wheel_ang),math.cos(wheel_ang)), 1.0)zbias(0)end})define_model('delta', { info = {scale = 1.00,bounding_radius = 30,materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},tags = { 'ship' },ship_defs = {{'Delta Glider', { 7*10^6,-87*10^6,4*10^6,-4*10^6,-4*10^6,4*10^6 },1*10^7,{{ v(0,-0.5,0), v(0,0,-1) },{ v(0,0,0), v(0,0,1) },},{ 70, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },70, 35, 35000,5}}},static = function(lod) set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)set_material('color1', .35,.1,.15,1,1,.85,.9,100) set_material('color2', .15,.1,.35,1,.90,.85,1,100) set_material('grey', .3,.3,.3,1,.3,.3,.3,10) set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)use_material('courier')texture('delta.png') call_model('dg', v(0,0,0), v(1,0,0), v(0,1,0),1) local vMainThruster = v(0,0,5) local vForwardThruster1 = v(-0.3,0.6,5.5) local vForwardThruster2 = v(-0.73,0.1,5.5) local vForwardThruster3 = v(-0.95,-0.34,5.5) local vForwardThruster4 = v(0.3,0.6,5.5) local vForwardThruster5 = v(0.73,0.1,5.5) local vForwardThruster6 = v(0.95,-0.34,5.5) local vRetroThruster1 = v(-1.2,0.1,1.5) local vRetroThruster2 = v(1.2,0.1,1.5) local v32 = v(-1.0, 1.0, -1.0)-- 32, right TEMPORARYlocal v33 = v(-1.0, -1.0, 1.0)local v34 = v(1.0, -1.0, -1.0)-- 34, left TEMPORARYlocal v35 = v(1.0, 1.0, 1.0)local v36 = v(-1.0, 1.0, -1.0)-- 36, top TEMPORARYlocal v37 = v(0.0, 1.0, 1.0)local v38 = v(0.0, -1.0, -1.0)-- 38, bottom TEMPORARYlocal v39 = v(0.0, -1.0, 1.0)thruster(vMainThruster, v(0,0,1), 7, true)thruster(vRetroThruster1, v(-0.2,0.2,-1), 3, true)thruster(vRetroThruster2, v(0.2,0.2,-1), 3, true)thruster(vForwardThruster1, v(0,0,1), 2, true)thruster(vForwardThruster2, v(0,0,1), 2, true)thruster(vForwardThruster3, v(0,0,1), 2, true)thruster(vForwardThruster4, v(0,0,1), 2, true)thruster(vForwardThruster5, v(0,0,1), 2, true)thruster(vForwardThruster6, v(0,0,1), 2, true)thruster(v32, v(-1,0,0), 1) --tempthruster(v33, v(-1,0,0), 1)thruster(v34, v(1,0,0), 1)thruster(v35, v(1,0,0), 1)thruster(v36, v(0,1,0), 1)thruster(v37, v(0,1,0), 1)thruster(v38, v(0,-1,0), 1)thruster(v39, v(0,-1,0), 1) --tempend,dynamic = function(lod)if get_arg(0) ~= 0 thenlocal v1 = v(0,-1,-2) --TEMPORARYlocal v2 = v(-1,-0.75,3) --TEMPORARYlocal v3 = v(1,-0.75,3) --TEMPORARYzbias(1, v1, v(0,-1,0))call_model('nosewheelunit', v1, v(-1,0,0), v(0,-1,0), 0.3)call_model('mainwheelunit', v2, v(-1,0,0), v(0,-1,0), 0.3)call_model('mainwheelunit', v3, v(-1,0,0), v(0,-1,0), 0.3)zbias(0)endend})
//EDITI finally managed to get the landing gear on there, and it loads in the model viewer and the game. However, when I try to take off the game crashes.
