Porting Meshes to Trailmakers

Spawning the Mesh

terrorsoul Intermediate Miscellaneous

Now that we have our folder for the mod and the mesh and texture file in the folder, let's create a main.lua file in the same folder and we will put the following lua code inside of the file. Make sure that the mesh file we exported from blender is the same name as in lua code below, the same in regards to the atlas texture.

tm.physics.AddMesh("mesh.obj", "themapmesh") -- The mesh
tm.physics.AddTexture("maptexture.png", "themaptexture") -- The texture
local themap = tm.physics.SpawnCustomObject(tm.vector3.Create(0,0,0), "themapmesh", "themaptexture")
themap.GetTransform().SetScale(-1) -- Sets the size of the map, Trailmakers loads in maps mirrored so we have to reverse it
themap.GetTransform().SetRotation(tm.vector3.Create(0,0,0) -- Sets the rotation of the map


Now save the changes and activate the mod. 

Congrats, you've successfully ported a game asset into Trailmakers and combined the textures into one atlas file.


Previous Step
Step 6 / 6

Discussion

Please log in to post a comment.