Tractor config
From Suf
This tutorial assumes you have made the Collision Mesh, Visible mesh, and wheel mesh(es) for your tractor and you have exported the .mesh and .material files and any textures to the correct directorys in the simufarm filesystem.
This is self explaintory. Open the Media directory: .mesh goes in the MODEL directory, .material goes in the SCRIPT directory and any textures goes in the TEXTURES directory.
Another note, getting the scale of your tractor is difficult and takes alot of trial and error. once youve got it into the game you may need to rescale it in the modeling program and re-export it to simufarm to correct the scale.
kcG8qQ Im thankful for the blog post.Really looking forward to read more. Much obliged.
Contents |
[edit] Sections of the file
It might look scary, but once you know what it does, you'll be fine!
ExampleTractor.mesh,Example_COLL.mesh,7500,0 -10 3
On this line we;
- Set the model of the tractor, The model that everybody sees
- Set the collision model of the tractor, this is what collides with everything.
- Set the weight of the tractor
- Set the position of the mass
Typically, the collision mesh will be a low-polly box model of the tractor. It must be under 100 polygons, and it does not need a texture or material since it'll be invisible. The computer will use it to calculate physics collisions.
The position of the mass is very important for good stability. Since we don't see it, we can manipulate it. Here, the mass is set to 0 -10 3, thats 10 units under the tractor, and 3 forwards. It's advisable to set the mass to -50 under the tractor, as this prevents it turning over.
ENGINE 0.1
On this line, we set the power of the engine. This is a very very small number, but we estimate 0.1 = arround 100hp.
CAM 0 12 -6,0 15 -10
[edit] Headline text
File:Example.jpgFile:Example.jpg
This is to set the position of the internal and external camera. They are both vector3d. To get these values you need to use Trial and error.
HOOK 0 0 -15
This is the position of the tractor's drawbar. You can use trial and error for this but it's nearly impossible. It's much easier to use something like the Physx debugger, Or even better you could activate our own Hookpoint debugging by [TODO]
WHEEL 6 0 10,false,true,5.0,Example_F.mesh
This is the first wheel, here we;
- Set the position of the wheel
- the first numer is side 2nd is height and 3rd is forwards and back
- Set whether this wheel drives or not
- Set whether this wheel steers or not
- Set the collision radius of this wheel
- Set the mesh of this wheel
This hopefully is pretty self explanatory. Just repeat the process for the rest of the wheels.
When you're done, save this file in "/bin/release/tractors" as a ".cfg" file.
[edit] Headline text
[edit] Adding the tractor
So, with the config done, we need to make it spawn.
Go to "/bin/release/map.map" and open it with notepad.
You will see some lines like
TRACTOR tm190.cfg, 0 1 50
This tells the game:
- Is it a TRACTOR or TRAILER
- The name of the config file you just made
- the position to spawn it
So, add your config and position, and run the game! your tractor should appear where you spawn it. Be carefull not to spawn it touching anything, or it will fly into the air.
Congratulations! you made a tractor in simufarm!