Page 1 of 1

Do it yourself - X-Wing

Posted: Thu Jun 07, 2012 10:07 pm
by Potsmoke66
the model,
Code:
define_model('xw_r2', {info = {lod_pixels = {.1, 10, 50, 0},bounding_radius = 10, materials = {'grey', 'win', 'chrome'},},static = function(lod)local v0 = v(0.0, 0.0, 0.0)local v1 = v(0.0, 0.1, 0.0)local v2 = v(0.0, 0.26, -0.3)local v3 = v(0.0, 0.26, -0.2)local divs = 3 * lodset_material('grey', 0.65, 0.64, 0.6, 1.0, 0.63, 0.7, 0.83, 30) set_material('chrome', 0.63, 0.7, 0.83, 1.0, 1.26, 1.4, 1.66, 30)set_material('win', 0.0, 0.0, 0.05, 1.0, 1.0, 1.0, 1.5, 100)texture('tex04.png',v(-0.5,-0.5,0.0), v(0.5,0.0,0.0), v(0.0,0.0,1.0))-- bodyuse_material('grey')cylinder(divs, v0, v1, v(0,0,1), 0.3)sphere_slice(divs, divs, 0.15 * 3.142, 0.5 * 3.142, matrix.translate(v1) * matrix.scale(v(0.3,0.3,0.3)))use_material('win')sphere_slice(divs, divs, 0, 0.15 * 3.142, matrix.translate(v1) * matrix.scale(v(0.3,0.3,0.3)))texture(nil)-- camerazbias(1, v2, v(0,0,-1))circle(2 * lod, v2, v(0,0,-1), v(0,1,0), 0.04)zbias(0)use_material('chrome')cylinder(2 * lod, v2, v3, v(0,1,0), 0.05)end})define_model('xw_wing_r0', {info = {lod_pixels = {.1, 10, 50, 0},bounding_radius = 10, materials = {'grey', 'matte', 'chrome', 'e_glow', 'i_glow', 'black', 'null', 'anthracite', 'red'},},static = function(lod)-- cuboid rlocal v100 = v(5.5,0.2,0.0) -- poslocal v102 = v(0.5,0.5,3.0) -- size-- wing toplocal v116 = v(6.0,0.2,0.4)local v120 = v(6.0,0.2,2.8)local v124 = v(1.8,0.3,0.4)local v128 = v(1.8,0.3,3.5)local v132 = v(0.0,0.3,0.4)local v136 = v(0.0,0.3,3.8)-- wing botlocal v118 = v(6.0,0.0,0.4)local v122 = v(6.0,0.0,2.8)local v126 = v(1.8,0.0,0.4)local v130 = v(1.8,0.0,3.5)local v134 = v(0.0,0.0,0.4)local v138 = v(0.0,0.0,3.8)-- inlet bez.quadlocal v140a = v(0.1,0.3,0.0)local v142a = v(0.5,1.05,0.0)local v144a = v(0.585,1.2,0.0)local v146a = v(1.615,1.63,0.0)local v148a = v(1.75,0.3,0.0)local v140b = v(0.1,0.3,2.5)local v142b = v(0.5,1.05,2.5)local v144b = v(0.585,1.2,2.5)local v146b = v(1.615,1.63,2.5)local v148b = v(1.75,0.3,2.5)-- inlet botlocal v150 = v(1.75,0.3,0.0)local v152 = v(1.55,0.1,0.0)local v154 = v(1.75,0.3,0.4)local v156 = v(1.55,0.1,0.4)local v158 = v(0.1,0.3,0.0)local v160 = v(0.3,0.1,0.0)local v162 = v(0.1,0.3,0.4)local v164 = v(0.3,0.1,0.4)-- cyl1local v168 = v(1.0,0.7,2.5)local v170 = v(1.0,0.7,4.4)-- cyl2local v172 = v(1.0,0.7,4.4)local v174 = v(1.0,0.7,4.8)-- gun cyllocal v176 = v(5.75,0.45,0.0)local v178 = v(5.75,0.45,-6.0)local v179 = v(5.75,0.45,-6.2)-- gun bez.quadlocal v180 = v(5.6,0.8,-5.4)local v182 = v(5.5,0.6,-5.3) local v184 = v(5.5,0.3,-5.3)local v186 = v(5.6,0.1,-5.4)local v188 = v(5.65,0.8,-5.35)local v190 = v(5.64,0.6,-5.25)local v192 = v(5.64,0.3,-5.25)local v194 = v(5.65,0.1,-5.35)local v196 = v(5.85,0.8,-5.35)local v198 = v(5.86,0.6,-5.25)local v200 = v(5.86,0.3,-5.25)local v202 = v(5.85,0.1,-5.35)local v204 = v(5.9,0.8,-5.4)local v206 = v(6.0,0.6,-5.3)local v208 = v(6.0,0.3,-5.3)local v210 = v(5.9,0.1,-5.4)-- inverted cyl front inletlocal v212 = v(1.0,0.7,0.0) local v214 = v(1.0,0.7,0.3)-- front inlet coverlocal v216 = v(1.5,0.7,0.1)local v218 = v(0.5,0.7,0.1)local v220 = v(1.0,0.7,0.1)local divs = 4 * lodif lod > 1 thenset_material('grey', 0.65, 0.64, 0.6, 1.0, 0.63, 0.7, 0.83, 30)set_material('matte', 0.38, 0.36, 0.35, 1.0, 0.52, 0.55, 0.55, 10) set_material('chrome', 0.63, 0.7, 0.83, 1.0, 1.26, 1.4, 1.66, 30)set_material('anthracite', 0.05, 0.05, 0.0, 1.0, 0.2, 0.2, 0.2, 10)set_material('black', 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0)set_material('null', 0.0, 0.0, 0.0, 0.0)set_material('red', 0.6, 0.05, 0.0, 0.7, 0.3, 0.3, 0.3, 10)if lod > 3 thenuse_material('black')-- gunzbias(1, v179, v(0,0,-1))circle(2 * lod, v179, v(0,0,-1), v(0,1,0), 0.07)zbias(0)enduse_material('chrome')texture('tex07.png',v(-0.7,-0.75,0.0), v(0.0,0.0,-0.03), v(0.0,4.5,0.0))endlathe(3*lod, v178, v179, v(0,1,0), {0.0,0.08, 1.0,0.08, 1.0,0.0})if lod > 1 thenuse_material('grey')endlathe(3*lod, v176, v178, v(0,1,0), {0.0,0.12, 1.0,0.08})if lod > 1 thenuse_material('matte')texture('tex03.png', v(-0.5,-0.5,0.0), v(0.0,0.5,0.0), v(0.0,0.0,-0.5))end-- wing tipquad(v116, v120, v122, v118)if lod > 1 thentexture('tex03.png', v(-0.5,-0.5,0.0), v(0.5,0.0,0.0), v(0.0,-0.5,0.0))end-- wing frontflat(1, v(0,0,-1), {v134}, {v132}, {v124}, {v116}, {v118}, {v126})-- wing rearflat(1, v(0,0,1), {v122}, {v120}, {v128}, {v136}, {v138}, {v130})-- engine inlet coverif lod > 1 thentexture(nil)use_material('anthracite')sphere_slice(3 * lod, 2 * lod, 0, 0.5 * 3.142, matrix.translate(v220) * matrix.rotate(0.5 * 3.142, v(-1,0,0)) * matrix.scale(v(0.2, 0.2, 0.2)))texture('tex03.png', v(0.5,0.5,0.0), v(0.5,0.0,0.0), v(0.0,0.5,0.0))use_material('grey')ring(2 * lod, v216, v218, v(0,1,0), 0.05)texture('tex03.png', v(0.5,0.5,0.0), v(0.0,0.5,0.0), v(0.0,0.0,0.5))-- engine inlet insideuse_material('matte')set_insideout(true)ring(divs, v212, v214, v(0,1,0), 0.45)set_insideout(false)use_material('i_glow')texture('tex01.png',v(-0.5,-0.75,0.0), v(1.0,0.0,0.0), v(0.0,1.0,0.0))circle(divs, v214, v(0,0,-1), v(0,1,0), 0.45)texture(nil)use_material('null')zbias(1,v212,v(0,0,-1))circle(divs, v212, v(0,0,-1), v(0,1,0), 0.45)zbias(0)-- wing tipuse_material('grey')texture('tex09.png', v(-0.96,-0.02,0.0), v(0.0,0.0,0.5), v(0.65,0.0,0.0))cuboid(v100, v102)endif lod > 1 thentexture('tex04.png', v(0.5,0.5,0.0), v(0.2,0.0,0.0), v(0.0,0.0,1.0))end-- wing topflat(1, v(0,1,0), {v116}, {v124}, {v132}, {v136}, {v128}, {v120})-- wing bottomflat(1, v(0,-1,0), {v118}, {v122}, {v130}, {v138}, {v134}, {v126})-- engine mainquad(v140a, v140b, v142b, v142a)cubic_bezier_quad(3*lod, 1, v142a, v142a+v(0.0,0.0,0.83), v142b-v(0.0,0.0,0.83), v142b,v144a, v144a+v(0.0,0.0,0.83), v144b-v(0.0,0.0,0.83), v144b,v146a, v146a+v(0.0,0.0,0.83), v146b-v(0.0,0.0,0.83), v146b,v148a, v148a+v(0.0,0.0,0.83), v148b-v(0.0,0.0,0.83), v148b)-- engine main frontflat(3*lod, v(0,0,-1), {v140a}, {v142a}, {v144a, v146a, v148a})-- engine main backflat(3*lod, v(0,0,1), {v140b}, {v148b}, {v146b, v144b, v142b})-- engine main bottomquad(v150, v152, v160, v158)quad(v152, v156, v164, v160)quad(v150, v154, v156, v152)quad(v158, v160, v164, v162)if lod > 1 then-- thruster insideuse_material('e_glow')texture('tex02.png',v(-0.5,-0.1,0.0), v(2.0,0.0,0.0), v(0.0,2.0,0.0))zbias(1, v172, v(0,0,1))circle(divs, v172, v(0,0,1), v(0,1,0), 0.25)zbias(0)texture(nil)use_material('matte')texture('tex08.png', v(-0.5,-0.5,0.0), v(1.0,0.0,0.0), v(0.0,0.0,-0.5))endcylinder(divs, v168, v170, v(0,1,0), 0.4)if lod > 1 then-- thruster insidetexture('tex06.png', v(-0.5,-0.5,0.0), v(0.5,0.0,0.0), v(0.0,1.0,1.0))use_material('matte')set_insideout(true)ring(divs, v172, v174, v(0,1,0), 0.25)set_insideout(false)-- gunuse_material('chrome')if lod > 3 thencubic_bezier_quad(4,4, v180, v182, v184, v186,v188, v190, v192, v194,v196, v198, v200, v202,v204, v206, v208, v210)set_insideout(true)cubic_bezier_quad(4,4, v180, v182, v184, v186,v188, v190, v192, v194,v196, v198, v200, v202,v204, v206, v208, v210)set_insideout(false)endend-- thrusterlathe(divs, v172, v174, v(0,1,0), {0.0,0.35, 1.0,0.35, 1.0,0.25})-- markerif lod > 1 thenlocal v_M = v(3.2,0.302,1.4)use_material('red')zbias(1, v_M, v(0,1,0))text("|||", v_M, v(0,1,0), v(1,0,0), 2.3, {center=true})zbias(0)call_model('coll_warn',v(6.0,0.45,0.25),v(0,1,0),v(1,0,0),1)endend, dynamic = function(lod)if lod > 1 then set_material('e_glow', lerp_materials(get_time('SECONDS')*.3, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.2, 1.7, 0.6 }, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.2, 0.0 })) set_material('i_glow', lerp_materials(get_time('SECONDS')*.3, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 2.0 }, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.5, 1.5 }))endend})define_model('xw_wing_r', {info = {bounding_radius = 10,},static = function(lod)call_model('xw_wing_r0', v(0.0, 0.0, 0.0), v(1,0,0), v(0,0,-1), 1.0)end})define_model('xw_wing_l0', {info = {lod_pixels = {.1, 10, 50, 0},bounding_radius = 10, materials = {'grey', 'matte', 'chrome', 'e_glow', 'i_glow', 'black', 'null', 'anthracite', 'red'},},static = function(lod)-- cuboid rlocal v100 = v(-6, 0.2, 0) -- poslocal v102 = v(0.5, 0.5, 3.0) -- size-- wing toplocal v116 = v(-6.0, 0.2, 0.4)local v120 = v(-6.0, 0.2, 2.8)local v124 = v(-1.8, 0.3, 0.4)local v128 = v(-1.8, 0.3, 3.5)local v132 = v(0.0, 0.3, 0.4)local v136 = v(0.0, 0.3, 3.8)-- wing botlocal v118 = v(-6.0, 0.0, 0.4)local v122 = v(-6.0, 0.0, 2.8)local v126 = v(-1.8, 0.0, 0.4)local v130 = v(-1.8, 0.0, 3.5)local v134 = v(0.0, 0.0, 0.4)local v138 = v(0.0, 0.0, 3.8)-- inlet bez.quadlocal v140a = v(-0.1, 0.3, 0.0)local v142a = v(-0.5, 1.05, 0.0)local v144a = v(-0.585, 1.2, 0.0)local v146a = v(-1.615, 1.63, 0.0)local v148a = v(-1.75, 0.3, 0.0)local v140b = v(-0.1, 0.3, 2.5)local v142b = v(-0.5, 1.05, 2.5)local v144b = v(-0.585, 1.2, 2.5)local v146b = v(-1.615, 1.63, 2.5)local v148b = v(-1.75, 0.3, 2.5)-- inlet botlocal v150 = v(-1.75, 0.3, 0.0)local v152 = v(-1.55, 0.1, 0.0)local v154 = v(-1.75, 0.3, 0.4)local v156 = v(-1.55, 0.1, 0.4)local v158 = v(-0.1, 0.3, 0.0)local v160 = v(-0.3, 0.1, 0.0)local v162 = v(-0.1, 0.3, 0.4)local v164 = v(-0.3, 0.1, 0.4)-- cyl1local v168 = v(-1.0, 0.7, 2.5)local v170 = v(-1.0, 0.7, 4.4)-- cyl2local v172 = v(-1.0, 0.7, 4.4)local v174 = v(-1.0, 0.7, 4.8)-- gun cyllocal v176 = v(-5.75, 0.45, 0.0)local v178 = v(-5.75, 0.45, -6.0)local v179 = v(-5.75, 0.45, -6.2)-- gun bez.quadlocal v180 = v(-5.6, 0.8, -5.4)local v182 = v(-5.5, 0.6, -5.3) local v184 = v(-5.5, 0.3, -5.3)local v186 = v(-5.6, 0.1, -5.4)local v188 = v(-5.65, 0.8, -5.35)local v190 = v(-5.64, 0.6, -5.25)local v192 = v(-5.64, 0.3, -5.25)local v194 = v(-5.65, 0.1, -5.35)local v196 = v(-5.85, 0.8, -5.35)local v198 = v(-5.86, 0.6, -5.25)local v200 = v(-5.86, 0.3, -5.25)local v202 = v(-5.85, 0.1, -5.35)local v204 = v(-5.9, 0.8, -5.4)local v206 = v(-6.0, 0.6, -5.3)local v208 = v(-6.0, 0.3, -5.3)local v210 = v(-5.9, 0.1, -5.4)-- inverted cyl front inletlocal v212 = v(-1.0, 0.7, 0.0) local v214 = v(-1.0, 0.7, 0.3)-- front inlet coverlocal v216 = v(-1.5, 0.7, 0.1)local v218 = v(-0.5, 0.7, 0.1)local v220 = v(-1.0, 0.7, 0.1)local divs = 4 * lodif lod > 1 thenset_material('grey', 0.65, 0.64, 0.6, 1.0, 0.63, 0.7, 0.83, 30)set_material('matte', 0.38, 0.36, 0.35, 1.0, 0.52, 0.55, 0.55, 10) set_material('chrome', 0.63, 0.7, 0.83, 1.0, 1.26, 1.4, 1.66, 30)set_material('anthracite', 0.05, 0.05, 0.0, 1.0, 0.2, 0.2, 0.2, 10)set_material('black', 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0)set_material('null', 0.0, 0.0, 0.0, 0.0)set_material('red', 0.6, 0.05, 0.0, 0.7, 0.3, 0.3, 0.3, 10)if lod > 3 thenuse_material('black')-- gunzbias(1, v179, v(0,0,-1))circle(2 * lod, v179, v(0,0,-1), v(0,1,0), 0.07)zbias(0)enduse_material('chrome')texture('tex07.png',v(-0.7,-0.75,0.0), v(0.0,0.0,-0.03), v(0.0,4.5,0.0))endlathe(3*lod, v178, v179, v(0,1,0), {0.0,0.08, 1.0,0.08, 1.0,0.0})if lod > 1 thenuse_material('grey')endlathe(3*lod, v176, v178, v(0,1,0), {0.0,0.12, 1.0,0.08})if lod > 1 thenuse_material('matte')texture('tex03.png', v(-0.5,-0.5,0.0), v(0.0,0.5,0.0), v(0.0,0.0,-0.5))end-- wing tipquad(v116, v118, v122, v120)if lod > 1 thentexture('tex03.png', v(-0.5,-0.5,0.0), v(0.5,0.0,0.0), v(0.0,-0.5,0.0))end-- wing frontflat(1, v(0,0,-1), {v134}, {v120}, {v118}, {v116}, {v124}, {v132})-- wing rearflat(1, v(0,0,1), {v122}, {v130}, {v138}, {v136}, {v128}, {v120})-- engine inlet coverif lod > 1 thentexture(nil)use_material('anthracite')sphere_slice(3 * lod, 2 * lod, 0, 0.5 * 3.142, matrix.translate(v220) * matrix.rotate(0.5 * 3.142, v(-1,0,0)) * matrix.scale(v(0.2, 0.2, 0.2)))texture('tex03.png', v(0.5,0.5,0.0), v(0.5,0.0,0.0), v(0.0,0.5,0.0))use_material('grey')ring(2 * lod, v216, v218, v(0,1,0), 0.05)texture('tex03.png', v(0.5,0.5,0.0), v(0.0,0.5,0.0), v(0.0,0.0,0.5))-- engine inlet insideuse_material('matte')set_insideout(true)ring(divs, v212, v214, v(0,1,0), 0.45)set_insideout(false)use_material('i_glow')texture('tex01.png',v(-0.5,-0.75,0.0), v(1.0,0.0,0.0), v(0.0,1.0,0.0))circle(divs, v214, v(0,0,-1), v(0,1,0), 0.45)texture(nil)use_material('null')zbias(1,v212,v(0,0,-1))circle(divs, v212, v(0,0,-1), v(0,1,0), 0.45)zbias(0)-- wing tipuse_material('grey')texture('tex09.png', v(-0.96,-0.02,0.0), v(0.0,0.0,0.5), v(0.65,0.0,0.0))cuboid(v100, v102)endif lod > 1 thentexture('tex04.png', v(0.5,0.5,0.0), v(-0.2,0.0,0.0), v(0.0,0.0,-1.0))end-- wing topflat(1, v(0,1,0), {v116}, {v120}, {v128}, {v136}, {v132}, {v124})-- wing bottomflat(1, v(0,-1,0), {v118}, {v120}, {v134}, {v138}, {v130}, {v122})-- engine mainset_insideout(true)quad(v140a, v140b, v142b, v142a)cubic_bezier_quad(3*lod, 1, v142a, v142a+v(0.0,0.0,0.83), v142b-v(0.0,0.0,0.83), v142b,v144a, v144a+v(0.0,0.0,0.83), v144b-v(0.0,0.0,0.83), v144b,v146a, v146a+v(0.0,0.0,0.83), v146b-v(0.0,0.0,0.83), v146b,v148a, v148a+v(0.0,0.0,0.83), v148b-v(0.0,0.0,0.83), v148b)-- engine main frontflat(3*lod, v(0,0,1), {v140a}, {v142a}, {v144a, v146a, v148a})-- engine main backflat(3*lod, v(0,0,-1), {v140b}, {v148b}, {v146b, v144b, v142b})-- engine main bottomquad(v150, v152, v160, v158)quad(v152, v156, v164, v160)quad(v150, v154, v156, v152)quad(v158, v160, v164, v162)set_insideout(false)if lod > 1 then-- thruster insideuse_material('e_glow')texture('tex02.png',v(-0.5,-0.1,0.0), v(2.0,0.0,0.0), v(0.0,2.0,0.0))zbias(1, v172, v(0,0,1))circle(divs, v172, v(0,0,1), v(0,1,0), 0.25)zbias(0)texture(nil)use_material('matte')texture('tex08.png', v(-0.5,-0.5,0.0), v(-1.0,0.0,0.0), v(0.0,0.0,0.5))endcylinder(divs, v168, v170, v(0,1,0), 0.4)if lod > 1 then-- thruster insidetexture('tex06.png', v(-0.5,-0.5,0.0), v(0.5,0.0,0.0), v(0.0,1.0,1.0))use_material('matte')set_insideout(true)ring(divs, v172, v174, v(0,1,0), 0.25)set_insideout(false)-- gunuse_material('chrome')if lod > 3 thencubic_bezier_quad(4,4, v180, v182, v184, v186,v188, v190, v192, v194,v196, v198, v200, v202,v204, v206, v208, v210)set_insideout(true)cubic_bezier_quad(4,4, v180, v182, v184, v186,v188, v190, v192, v194,v196, v198, v200, v202,v204, v206, v208, v210)set_insideout(false)endend-- thrusterlathe(divs, v172, v174, v(0,1,0), {0.0,0.35, 1.0,0.35, 1.0,0.25})-- markerif lod > 1 thenlocal v_M = v(-3.2,0.302,1.4)use_material('red')zbias(1, v_M, v(0,1,0))text(":)", v_M, v(0,1,0), v(0,0,1), 2.0, {center=true})zbias(0)call_model('coll_warn',v(-6.0,0.45,0.25),v(0,1,0),v(1,0,0),1)endend, dynamic = function(lod)if lod > 1 then set_material('e_glow', lerp_materials(get_time('SECONDS')*.3, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.2, 1.7, 0.6 }, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.2, 0.0 })) set_material('i_glow', lerp_materials(get_time('SECONDS')*.3, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 2.0 }, {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.5, 1.5 }))endend})define_model('xw_wing_l', {info = {bounding_radius = 10,},static = function(lod)call_model('xw_wing_l0', v(0.0, 0.0, 0.0), v(1,0,0), v(0,0,-1), 1.0)end})define_model('xw_r_thruster', {info = {bounding_radius = 5,},static = function(lod)thruster(v(1.0,4.8,-0.7),v(0,1,0),10,true)end})define_model('xw_l_thruster', {info = {bounding_radius = 5,},static = function(lod)thruster(v(-1.0,4.8,-0.7),v(0,1,0),10,true)end})define_model('xwing', {info = {scale = 1, lod_pixels = {0.1, 10, 50, 0},bounding_radius = 15, materials = {'grey', 'matte', 'chrome', 'e_glow', 'i_glow', 'black', 'null', 'red', 'anthracite', 'win'},tags = {'ship'},},static = function(lod)-- sidelocal v0 = v(0.3, 0.0, -9.0)local v1 = v(-0.3, 0.0, -9.0)local v2 = v(0.47, 0.45, -7.6)local v3 = v(-0.47, 0.45, -7.6)local v4 = v(0.49, -0.4, -7.3)local v5 = v(-0.49, -0.4, -7.3)local v6 = v(0.75, 0.8, -2.2)local v7 = v(-0.75, 0.8, -2.2)local v8 = v(0.9, -0.65, 0.3)local v9 = v(-0.9, -0.65, 0.3)local v10 = v(0.9, 1.3, 0.5)local v11 = v(-0.9, 1.3, 0.5)local v12 = v(1.0, -1.2, 2.5)local v13 = v(-1.0, -1.2, 2.5)local v14 = v(0.9, 1.2, 6.2)local v15 = v(-0.9, 1.2, 6.2)local v16 = v(1.2, 0.1, 6.5)local v17 = v(-1.2, 0.1, 6.5)local v18 = v(0.9, -1.0, 6.2)local v19 = v(-0.9, -1.0, 6.2)-- toplocal v20 = v(0.4, 0.8, -2.2)local v21 = v(-0.4, 0.8, -2.2)local v22 = v(0.4, 0.8, -2.0)local v23 = v(-0.4, 0.8, -2.0)local v24 = v(0.75, 1.1, -0.25)local v25 = v(-0.75, 1.1, -0.25)local v26 = v(0.75, 1.1, -0.2)local v27 = v(-0.75, 1.1, -0.2)local v28 = v(0.5, 1.3, 0.5)local v29 = v(-0.5, 1.3, 0.5)-- rostrumlocal v30 = v(0.35, 0.8, -2.2)local v32 = v(0.35, 0.8, -2.0)local v34 = v(0.4, 0.78, -2.4)local v36 = v(0.35, 0.78, -2.4)local v37 = v(-0.35, 0.78, -2.4)local v38 = v(0.4, 0.9, -2.0)local v40 = v(0.35, 0.9, -2.0)local v41 = v(-0.35, 0.9, -2.0)local v42 = v(0.7, 1.1, -0.25)local v44 = v(0.7, 1.1, -0.2)local v46 = v(0.5, 1.3, -0.25)local v48 = v(0.45, 1.3, -0.25)local v50 = v(0.5, 1.4, -0.25)local v52 = v(0.45, 1.4, -0.25)local v53 = v(-0.45, 1.4, -0.25)local v54 = v(0.5, 1.3, -0.2)local v56 = v(0.45, 1.3, -0.2)local v58 = v(0.5, 1.4, -0.2)local v60 = v(0.45, 1.4, -0.2)local v62 = v(0.5, 1.3, 0.2)local v64 = v(0.45, 1.3, 0.2)local v66 = v(0.5, 1.4, 0.25)local v68 = v(0.45, 1.4, 0.25)local v69 = v(-0.45, 1.4, 0.25)local v70 = v(0.5, 1.3, 0.5)local v72 = v(0.45, 1.3, 0.5)local v74 = v(0.5, 1.3, 0.6)local v76 = v(0.45, 1.3, 0.6)local v77 = v(-0.45, 1.3, 0.6)-- r2local v78 = v(0.0, 1.3, 1.3)local v80 = v(0.0, 1.1, 1.3)-- wing jointslocal v86 = v(1.0, 0.0, 2.4)local v88 = v(1.0, 0.0, 6.0)divs = 4 * lodif lod > 1 thenset_material('grey', 0.65, 0.64, 0.6, 1.0, 0.63, 0.7, 0.83, 30)set_material('matte', 0.28, 0.26, 0.25, 1.0, 0.22, 0.25, 0.25, 10) set_material('chrome', 0.63, 0.7, 0.83, 1.0, 1.26, 1.4, 1.66, 30)set_material('black', 0.05, 0.05, 0.0, 1.0, 0.2, 0.2, 0.2, 10)set_material('null', 0.0, 0.0, 0.0, 0.0)set_material('red', 0.6, 0.05, 0.0, 1.0, 0.3, 0.3, 0.3, 10)set_material('anthracite', 0.05, 0.05, 0.0, 1.0, 0.2, 0.2, 0.2, 10)set_material('win', 0.0, 0.0, 0.05, 1.0, 1.0, 1.0, 1.5, 100)-- r2call_model('xw_r2', v80, v(1,0,0), v(0,1,0), 1.0)use_material('matte')texture('tex03.png', v(-0.5,-0.5,0.0), v(1.0,0.0,0.0), v(0.0,0.0,-1.0))set_insideout(true)cylinder(divs, v78, v80, v(0,0,1), 0.4)set_insideout(false)texture(nil)use_material('null')zbias(1, v78, v(0,1,0))circle(divs, v78, v(0,1,0), v(0,0,1), 0.4)zbias(0)use_material('red')texture('tex04.png', v(0.5,0.5,0.0), v(0.0,0.0,-1.0), v(0.0,0.2,0.0))end-- nose sidesxref_tri(v0, v2, v4)if lod > 1 thenuse_material('grey')end-- sidesxref_quad(v4, v2, v6, v8)xref_quad(v8, v6, v10, v12)xref_tri(v10, v14, v16)xref_tri(v10, v16, v12)xref_tri(v12, v16, v18)if lod > 1 thentexture('tex04.png', v(0.5,0.5,0.0), v(0.0,0.2,0.0), v(0.0,0.0,-1.0))use_material('red')end-- nose topquad(v0,v1, v3, v2)-- nose bottomquad(v0, v4, v5, v1)if lod > 1 thenuse_material('grey')end-- bottomquad(v4, v8, v9, v5)quad(v8, v12, v13, v9)quad(v12, v18, v19, v13)-- topquad(v2, v3, v21, v20)xref_tri(v2, v20, v6)xref_quad(v6, v20, v44, v10)xref_tri(v44, v28, v10)-- rostrum topquad(v36, v37, v41, v40)quad(v52, v53, v69, v68)-- rear topif lod > 1 thentexture('tex12.png', v(-0.51,-0.8,0.0), v(0.4,0.0,0.0), v(0.0,0.0,-0.4))endquad(v10, v11, v15, v14)-- backif lod > 1 thenuse_material('matte')texture('tex11.png', v(-0.5,-0.55,0.0), v(0.4,0.0,0.0), v(0.0,-0.5,0.0))endquad(v16, v14, v15, v17)quad(v16, v17, v19, v18)-- wing jointif lod > 1 thenuse_material('matte')texture('tex05.png', v(-0.5,-0.5,0.0), v(1.0,0.0,0.0), v(0.0,0.0,-0.5))endxref_cylinder(divs, v86, v88, v(0,1,0), 0.4)-- rostrumif lod > 1 thenuse_material('chrome')texture('tex06.png', v(-0.5,-0.5,0.0), v(0.5,0.0,0.0), v(0.0,0.0,-1.0))end-- top viewxref_quad(v34, v36, v40, v38)xref_quad(v38, v40, v52, v50)xref_quad(v50, v52, v60, v58)xref_quad(v58, v60, v68, v66)xref_quad(v66, v68, v76, v74)xref_quad(v20, v22, v32, v30)xref_quad(v22, v46, v48, v32)xref_quad(v54, v62, v64, v56)xref_quad(v62, v70, v72, v64)-- side viewxref_quad(v34, v38, v22, v20)xref_quad(v22, v38, v50, v46)xref_quad(v46, v50, v58, v54)xref_quad(v54, v58, v66, v62)xref_quad(v62, v66, v74, v70)xref_quad(v24, v46, v54, v26)xref_quad(v36, v40, v32, v30)xref_quad(v32, v48, v52, v40)xref_quad(v48, v56, v60, v52)xref_quad(v56, v64, v68, v60)xref_quad(v64, v72, v76, v68)xref_quad(v42, v44, v54, v46)-- front viewxref_quad(v24, v42, v48, v46)xref_quad(v26, v54, v56, v44)if lod > 1 thenuse_material('win')texture(nil)endzbias(1, v(0,0,0), v(0,1,0))quad(v40, v41, v53, v52)quad(v68, v69, v77, v76)xref_quad(v20, v22, v46, v24)xref_quad(v54, v62, v70, v26)zbias(0)end, dynamic = function(lod)-- wingslocal v82 = v(1.1, 0.05, 2.1)local v83 = v(-1.1, -0.05, 2.1)local v84 = v(-1.1, 0.05, 2.1)local v85 = v(1.1, -0.05, 2.1)-- textlocal v90 = v(0.902, 0.5, -0.2)local v91 = v(-0.902, 0.5, -0.2)if lod > 2 thenlocal reg = get_label()use_material('red')zbias(1, v90, v(1,0,0))text(reg, v90, v(1,0,0), v(0,0,-1), 0.4, {center=true})zbias(1, v91, v(-1,0,0))text(reg, v91, v(-1,0,0), v(0,0,1), 0.4, {center=true})zbias(0)endlocal w_pos = 0.1*3.142*get_animation_position('WHEEL_STATE')call_model('xw_wing_r', v82, v(math.cos(-w_pos+0.1*3.142),math.sin(-w_pos+0.1*3.142),0), v(0,0,1), 1.0)call_model('xw_wing_r', v83, v(math.cos(-w_pos+1.1*3.142),math.sin(-w_pos+1.1*3.142),0), v(0,0,1), 1.0)call_model('xw_wing_l', v84, v(math.cos(-w_pos+0.1*3.142),-math.sin(-w_pos+0.1*3.142),0), v(0,0,1), 1.0)call_model('xw_wing_l', v85, v(math.cos(-w_pos+1.1*3.142),-math.sin(-w_pos+1.1*3.142),0), v(0,0,1), 1.0)if lod > 1 thencall_model('xw_r_thruster', v82, v(math.cos(-w_pos+0.1*3.142),math.sin(-w_pos+0.1*3.142),0), v(0,0,1), 1.0)call_model('xw_r_thruster', v83, v(math.cos(-w_pos+1.1*3.142),math.sin(-w_pos+1.1*3.142),0), v(0,0,1), 1.0)call_model('xw_l_thruster', v84, v(math.cos(-w_pos+0.1*3.142),-math.sin(-w_pos+0.1*3.142),0), v(0,0,1), 1.0)call_model('xw_l_thruster', v85, v(math.cos(-w_pos+1.1*3.142),-math.sin(-w_pos+1.1*3.142),0), v(0,0,1), 1.0)endend})
the textures,the ship specs,
Code:
define_ship {name='X-Wing',model='xwing',forward_thrust = -4e6,reverse_thrust = 2e6,up_thrust = 1e6,down_thrust = -1e6,left_thrust = -1e6,right_thrust = 1e6,angular_thrust = 8e6,gun_mounts ={{ v(0,0,-11.5), v(0,0,-1) },{ v(0,-.8,4.5), v(0,0,1) },},max_cargo = 15,max_laser = 1,max_missile = 0,max_fuelscoop = 0,max_cargoscoop = 0,max_cargolifesupport = 0,capacity = 15,hull_mass = 8,fuel_tank_mass = 2,thruster_fuel_use = 0.0001,price = 25000,hyperdrive_class = 1,}
;)edit: updated for alpha23a quick howto, could be someone don't knows what to do with it.this model is complete with the data you get above.copy-paste the models script to a new text file (plain text, use a simple text editor), name it i.e. xwing.lua and store it in a directory named i.e. ".../data/models/ships/xwing"download the textures and place them to the same directory as the models script (".../data/models/ships/xwing").copy-paste the ship specs to a new text file, name it i.e. xwing.lua and store it in the ".../data/ships/" directory.[/hr]it's a rather simple model, i've given no explanations except to name the sections for the geometry as well as for the vector listing.it's free because it's a model "from scratch" or at least a transscription, no original data used ;) . feel free to snoop it and work on whatever you like.perhaps i upload some basic UV projections (top, side, fron, rear view), so you can use them to create own textures.uv projection from side[attachment=1257:uvside_xw_body.jpg]