@Anachron13
Try this, this may work.
There may be some synthex error, try to correct yourself, I can't test it here.
In general, the problem can be resolved by reusing this kind of scripts. Since here the seat position is just about the matrix transformation things...
If you have chance to into my elevated station mod, you will see all the roof part of the station is generated in the code from a cube of 1x1x1 with triangular functions, not a loaded model. This kind of calculating is very interesting sometimes.
local vec3 = require "vec3"
local transf = require "transf"
local rotB = transf.degToRad(180.0, 0.0, 0.0)
local rotA = transf.degToRad(0.0, 0.0, 0.0)
local XCoords =
{
{0, rotB},
{-0.9, rotB},
{-1.8, rotB},
{-2.99, rotA},
{-3.89, rotA},
{-4.79, rotA},
{-16.87, rotB},
{-17.77, rotB},
{-18.67, rotB},
{-19.57, rotB},
{-20.47, rotB},
{-21.66, rotA},
{-22.56, rotA},
{-23.46, rotA}
}
local YCoords = {0.97, 0.55, -0.55, -0.97}
local function seatGen(xCoords, yCoords)
local result = {}
for _, y in ipairs(yCoords) do
for _, xr ipairs(xCoords) do
local x, tr = table.unpack(xr) -- tr : second to apply, to rotate seat
local t = transf.transl(vec3.new(0, 0.075, 1.37)) -- first to apply, to centralize seats
local t2 = transf.transl(vec3.new(11.71 + x, y, 0)) -- last to apply, to put the seat in place
table.insert( result, { group = 1, transf = trans.mul(transf.mul(t2, tr), t) })
-- if it doesn't work correctly, try trans.mul(t2, transf.mul(t, tr)),
-- the multiply of matrix in trans.lua is a liitle strange,
-- that's why I have written my own matrix lib in my station mods
end
end
return result
end
function data()
{
...
},
transportVehicle = {
...
seats = seatGen(XCoords, YCoords)
},
},
},
}
end
Alles anzeigen