// requires a global list called draws, apparently @lazyglobal off. parameter vec is V(0,0,0). function RenderVectorWithComponents { parameter vec. parameter prefix is "". if prefix <> "" { set prefix to prefix + " ". } local dv is 0. local dx is 0. local dy is 0. local dz is 0. set dv to VecDraw(V(0,0,0), vec, WHITE, prefix + "v", 1.0, true). draws:add(dv). set dx to VecDraw(V(0,0,0), V(vec:X,0,0), RED, prefix + "x", 1.0, true). draws:add(dx). set dy to VecDraw(V(0,0,0), V(0,vec:Y,0), GREEN, prefix + "y", 1.0, true). draws:add(dy). set dz to VecDraw(V(0,0,0), V(0,0,vec:Z), BLUE, prefix + "z", 1.0, true). draws:add(dz). } function RenderVectorShipRelative { parameter vec. parameter prefix is "". if prefix <> "" { set prefix to prefix + " ". } // this seems backwards, but velocity vectors at least seem to work this way. local axes is 0. lock axes to lookdirup(SHIP:FACING:FOREVECTOR, SHIP:UP:FOREVECTOR). local dv is 0. local dx is 0. local dy is 0. local dz is 0. set dv to VecDraw(V(0,0,0), vec, WHITE, prefix + "v", 1.0, true). draws:add(dv). set dx to VecDraw(V(0,0,0), V(vec:X,0,0), RED, prefix + "x", 1.0, true). draws:add(dx). set dy to VecDraw(V(0,0,0), V(0,vec:Y,0), GREEN, prefix + "y", 1.0, true). draws:add(dy). set dz to VecDraw(V(0,0,0), V(0,0,vec:Z), BLUE, prefix + "z", 1.0, true). draws:add(dz). } function RenderDirAxes { parameter dir. parameter prefix is "". if prefix <> "" { set prefix to prefix + " ". } local dx is 0. local dy is 0. local dz is 0. set dx to VecDraw(V(0,0,0), dir:RIGHTVECTOR * 100, RED, prefix + "x", 1.0, true). draws:add(dx). set dy to VecDraw(V(0,0,0), dir:TOPVECTOR * 100, GREEN, prefix + "y", 1.0, true). draws:add(dy). set dz to VecDraw(V(0,0,0), dir:FOREVECTOR * 100, BLUE, prefix + "z", 1.0, true). draws:add(dz). } if vec <> V(0,0,0) { // RenderVectorShipRelative(vec). RenderDirAxes(vec). } function ClearRenders { set draws to list(). ClearVecDraws(). }