some standarts for modelers:- basic scale, ~10x FE2/FFE (exactly 8.7x), models in this scale are compliant to meters in pioneer and have not to be scaled. one unit = 1m (vertex spacing, it's not exactly fe2, 1m would be 1.149 units). if you setup such a grid in your 3d modeling prog. you can exactly determine where you have to position sub models, thrusters, pos. lights and such things in the lua script.- you can put assets of models for one model in to the mods folder. best if you setup a folder in mods named ships (leaves possibility for "buildings", or "general" (or others) folder, and into that you can drop the new ship into a separate folder named same as the model (just that you know what it is afterwards).- for each material you like to set to your ship in pioneer, you will need a separate .obj file- take the "Cobra MKIII" and my "Mercury Predator" as a guide, check how materials been specified and applied.- example model script,
Code:
-- first we load the engine modeldefine_model('mercury_tip', { -- give here a unique name to the model (no spaces)info = { -- model specslod_pixels= { 50, 100, 200, 0 }, -- level of detailbounding_radius = 50, -- this sizes the ship so that it fits to the preview windowmaterials={'default','thrusters', 'matvar0', 'matvar1'}, -- all used materials must be listed here},static = function(lod) -- open static functions -- material specifications; diffuse r,g,b, alpha trans, specular r,g,b, shinyness, environmental r,g,bset_material('default', .70, .70, .85,1, .90, .90, 1, 50, 0, 0, 0) use_material('default')load_obj('mercury_tip1.obj', Mat4x4.new(v(1,0,0),v(0,1,0),v(0,0,1))) -- load model, transform matrix (see also cobra_mk3use_material('matvar0') -- color variable material1, set in dynamic functionsload_obj('mercury_tip2.obj', Mat4x4.new(v(1,0,0),v(0,1,0),v(0,0,1)))use_material('matvar1') -- color variable material2, set in dynamic functionsload_obj('mercury_tip3.obj', Mat4x4.new(v(1,0,0),v(0,1,0),v(0,0,1)))set_material('thrusters', .30, .30, .30,1, .30, .30, .30, 20)use_material('thrusters')-- note, not all thrusters are listed here, compare with cobra_mk3.lua or ships.lualocal vBackThruster = v(0, 0, 30) -- vector x,y,z, last number is how far back down the ship it is, y is heightlocal vFrontThruster = v(0, 0, -16)xref_thruster(vBackThruster, v(0,0,1), 40, true) -- main thruster position, directional vector, float size and bool linear_only (true/false)xref_thruster(vFrontThruster, v(0,0,-1), 10, true)local TopThrustForward = v(0, 3, 16) -- define thruster positionlocal BottomThrustForward = v(0, -3, 16)thruster(TopThrustForward, v(0,1,0), 10) -- use thruster position, set directional vector, float size and bool linear_only (true/false)thruster(BottomThrustForward, v(0,-1,0), 10)local LeftForwardThruster = v(-3, 0, 16)local RightForwardThruster = v(3, 0, 16)thruster(LeftForwardThruster, v(-1,0,0), 10)thruster(RightForwardThruster, v(1,0,0), 10)end, -- end of static functions. important! if you specify no dynamic functions end without commadynamic = function(lod) -- open dynamic functionsset_material('matvar0', get_arg_material(0)) -- set color variable material1set_material('matvar1', get_arg_material(1)) -- set color variable material2, there is at least one matte color variable material (2), you can use this also for textif get_arg(0) ~= 0 then -- requests landing gear anim-- pos. light redlocal lightphase = math.fmod(get_arg(1), 1)if lightphase > .7 then -- determinates when the light has to glowbillboard('smoke.png', 4, v(1,0,0), { v(0, 2.5, 20) }) -- call texture and specify size, color and vector (rotation?)end -- ends ifend -- ends dynamic functionsend -- ends define model}) -- careful with the brackets, close allways as much as you opened. check "stdout.txt" if the script fails.-- now we load the main modeldefine_model('mercury', {info = { lod_pixels = { 50, 100, 200, 0 },bounding_radius = 100,materials = {'thrusters', 'text', 'default', 'matvar0', 'matvar1', 'matte'},tags = {'ship'}, -- what kind of model it is, (ship or station)ship_defs = { -- ship specs{'Mercury Predator', -- the name that appears on the shiplist{ 2*10^7,-3*10^7,1*10^7,-1*10^7,-1*10^7,1*10^7 }, -- acceleration ratio, rev, fwd, empty, ladden 4*10^7, -- acceleration base? (has not much effect, i'm not shure){ v(0,0.6,-24.2), v(0,0,-1)}, -- position, direction vector lasers (i left out the others, but still the game crashes when only one gunmounting is specified, i entered some values but nothing seems to happen?){ 140, 1, 2, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, -- capacity(again?), ?, gunmountings (crashes when specified 1), missile pylons, the rest ?????????????????140, 180, 32000000, -- tons capacity, tons hull mass, price in cents4 -- pre mounted hyperspace drive class }}},static = function(lod)-- material_name, diff r, diff g, diff b, alpha, spec r, spec g, spec b, shiny, env r, env g, env bset_material('default', .70, .70, .85,1, .90, .90, 1, 50, 0, 0, 0)set_material('matte', 0, 0, 0,1, .60, .60, .60, 10, 0, 0, 0)set_material('text', .9, .9, .9,1, .6, .6, .6, 10, 0, 0, 0)use_material('default')load_obj('mercury_eng.obj', Mat4x4.new(v(1,0,0),v(0,1,0),v(0,0,1)))use_material('matvar1')load_obj('mercury_top.obj', Mat4x4.new(v(1,0,0),v(0,1,0),v(0,0,1))) use_material('matvar0')load_obj('mercury_bot.obj', Mat4x4.new(v(1,0,0),v(0,1,0),v(0,0,1))) use_material('matte')load_obj('mercury_mat.obj', Mat4x4.new(v(1,0,0),v(0,1,0),v(0,0,1))) end,dynamic = function(lod)local v10 = v(31.6, -11.1, -9.3) -- you can also pre define vectors (very important for scripted models)local v11 = v(-31.6, -11.1, -9.3)set_material('matvar0', get_arg_material(0))set_material('matvar1', get_arg_material(1))call_model('mercury_tip', v10, v(-1,0,0), v(0,-1,0), 1) -- call model only works as dynamic function vector position, vector xaxis, vector yaxis, float scalecall_model('mercury_tip', v11, v(-1,0,0), v(0,-1,0), 1)-- geomflag(0x8000) -- turns off collision level-- local reg = get_arg_string(0) -- set "reg" to reg. nr.-- text(reg, v(20, 2, 1), v(20, 2, 30), v(0,0,-1), 2.0, {xoffset=0, yoffset=0}) -- text "reg", vector pos, vector normals, vector textdir, float scale [,{center=true/false}], additional offset-- text(reg, v(-20, 2, 1), v(-20, 2, 30), v(0,0,1), 2.0, {xoffset=0, yoffset=0})-- geomflag(0) -- turns on collision levelif get_arg(0) ~= 0 then -- requests landing gear anim-- lights local lightphase = math.fmod(get_arg(1), 1)if lightphase > .4 thenbillboard('smoke.png', 4, v(.2,.2,1), { v(0, 7, 18) }) -- pos. light blueelseif lightphase > .1 thenbillboard('smoke.png', 4, v(.8,.8,.8), { v(0, 0.2, -19) }) -- pos. light white endendend})
i hope this will help

it looks more complicated then it is.

pioneer is cool

[attachment=109:predator_pre10.jpg]