Ok here we go really simple!!!
I build a small car with a small chassis (length: 370 cm; width: 160 cm; height: 140 cm) and four wheels (radius: 30cm; height: 20cm).
The wheelbase is 240cm. I think this small construction should be no problem for everyone who got some expirience with 3d max.
Every Object in 3d max got a name so we can find them easy in outerra later.
Chassis <- the main red chassis
wheel_FR <- front right wheel
wheel_FL <- front left wheel
wheel_RR <- rear right wheel
wheel_RL <- rear left wheel
Now some very important facts which caused much trouble in the beginning of my journey to a small car in outerra.
In 3d max 2013 the front of your car should show
North! The pivot axis should be aranged with Z (blue) up, Y (green) to the front and X (red) to the side. The pivot have to be aranged this way for the chassis and each wheel! Otherwise we got later some really funny effects
Now we use the "select and link" button
Mark with the left mouse button and ctrl all four wheels and after that hover with the mouse over one of the wheels (does'nt matter which one) and leftclick + drag. Aim for the chassis and release the left mouse button. Now all four wheels are connected to the chassis and will stay with it no matter where it goes
.
Pls check again if all pivots are aligned correct! Export with the free downloadable
OpenCollada PluginNow open Anteworld
Hit F7 and click the "Import ..." button. Navigate to the Folder where you saved the DAE file. If you see the file in the browser of Anteworld mark it so it is highlighted in blue and press "OK". Now Anteworld is processing. Wait until you see the button "Configure >>" and press it.
The first package object is the "EnviromentAmbientLight". It should stay on "ignore".
Press the dropdown button and select the chassis. Select for this "vehicle".
Now we see our objects related to the chassis and the names. Mark the bones like I did and press "Import >>" At this point Antworld is missing some UVs but this isn't important now.
The vehicle should hang around in the air in front of you. Until now we cant do anything with this small "beauty". Press close and feel free to take a small walk around the model. If you're done press again F7 and scroll down in the buildings list. Search for your ingame nick and will find soon our new created object. Mark it and press "Place". Our vehicle spawns right below us on the ground. Hit Escape so we leave the menu.
Go close to the car and hit Return so we enter the vehicle. You now see the vehicle from the cockpit view. Press C so we can watch from outside what will happen now.
Press Alt + E
This opens the Editor.
Instead of taking the full example code from here
Vehicle Example Script we just take some important parts of it. Its a minimum so we can move the vehicle around and play with some physics.
Let us start ... first we put into the brakets of
function init_chassis() ...
function init_chassis()
{
var wheelparam = {
radius: 0.7, <-- edit this to 0.3 (remember our wheel radius of 30cm!)
width: 0.45, <-- edit this to 0.2 (this represents the height parameter in 3d max of 20cm!)
suspension_max: 0.2,
suspension_min: -0.35,
suspension_stiffness: 5.0,
damping_compression: 0.2,
damping_relaxation: 0.12,
slip: 0.8,
roll_influence: 0.1};
}
You can play around with the other parameters later. Now we add our wheels so Anteworld knows which objects are used for that and some wheight for our car
function init_chassis()
{
var wheelparam = {
radius: 0.3,
width: 0.2,
suspension_max: 0.2,
suspension_min: -0.35,
suspension_stiffness: 5.0,
damping_compression: 0.2,
damping_relaxation: 0.12,
slip: 0.8,
roll_influence: 0.1
};
this.add_wheel('wheel_FR',wheelparam); <-- the name "wheel_FR" is the name you used for your wheel in 3d max
this.add_wheel('wheel_FL',wheelparam);
this.add_wheel('wheel_RR',wheelparam);
this.add_wheel('wheel_RL',wheelparam);
return {mass:800}; should be in kg so I took 800 which represents a realistic wheight for a small car in real life
}
We are almost done!! I dont added anything under the next two sections ... (I think some call them "Events")
function init_vehicle(){
}
function engine(start){
}
Now watch out! The next part we add before the next Event.
const EF = 27000.0; <-- this parameter where too much for our small car. I reduced it to 7000.0
const BF = 28000.0; <-- this one down too to 8000.0 (again you can play around with this later)
const maxkmh = 100; <-- this explains itself I think ... feel free
const forceloss = EF / (0.2*maxkmh + 1); <-- I am not sure but I think this is the road friction
function update_frame(dt, engine, brake, steering)
{
}
Now we copy a lot of code which I dont really understand but we need it so ... why take care? Just copy and paste. Maybe someone can explain this part step by step. Important thing is ... we put this now into the update_frame function.
function update_frame(dt, engine, brake, steering)
{
var kmh = this.speed()*3.6;
var redux = engine>=0 ? 0.2 : 0.6;
var esign = engine<0 ? -1 : 1;
engine = EF*Math.abs(engine);
var force = (esign>0) == (kmh>=0)
? engine/(redux*Math.abs(kmh) + 1)
: engine;
force -= forceloss;
force = Math.max(0.0, Math.min(force, engine));
engine = esign*force;
}
So now we add some really important code! Put it right below ...
function update_frame(dt, engine, brake, steering)
{
var kmh = this.speed()*3.6;
var redux = engine>=0 ? 0.2 : 0.6;
var esign = engine<0 ? -1 : 1;
engine = EF*Math.abs(engine);
var force = (esign>0) == (kmh>=0)
? engine/(redux*Math.abs(kmh) + 1)
: engine;
force -= forceloss;
force = Math.max(0.0, Math.min(force, engine));
engine = esign*force;
steering *=0.6;
brake *= BF;
this.steer(-2, steering); the "-2" says that we use the first to wheels which we declared above in this case "wheel_FR" and "wheel_FL"
this.wheel_force(-1, engine); "-1" is a 4x4 we could do it only for front or rear wheels too but this is the most easy way now
this.wheel_brake(-1, brake); same like the force
this.animate_wheels();
}
And now ... click "reload". The Car should drop on his wheels and show some bumping. Press Alt + E again to exit the script. Have fun now
I hope I dont bring any mistakes in here. If something doesn't work feel free to reply. I know my english isn't the best because it is not my main language but it should be enough for this. It is my first attempt to write something like this down. Remember I was until last night totally new to this all ... would be cool to see your results. I go now to the caterpillar website and get some inspiration.
Btw ... I WANT A TANK CLASS!!! My Jagdtiger (or should I call it Antetiger) is waiting for Outerra.