Creating your first car by Brrseb
So you`re ready to begin your second lesson, huh? Well, if you ever wanted to know how to make a car in OFP you`re in the right place. This lesson will teach you the basic on how to set up a car in OFP. It wont teach you how to model one (3d modeling lessons can be found all over net), but a step-by-step guide on how to get a car model in the game.
If you haven't already made a car model that you want to test in OFP, you can download a very simple model from this site (see next page). I`ll be using that one during my tutorial. Be aware, compared to Mechanics fine automobiles this one is so ugly your eyes will burn.
But to make up for my lack of modeling skills, I`ll make sure that we get to test our model in OFP very early on! I have read many different tutorials for different stuff and many of them are very long and it takes ages before you get some results. No such things here. Here we get to make some small adjustments, compile and test our result right away! That means a little hard work made up by LOT of fun test driving in OFP during the tutorial.
So, what do we need then. Lets see:
OK, that's the most important things. Lets have a look at our model next:
Lets have a look at the model that I will be using during this tutorial. Its ugly as hell but its all you need to get a good understanding on how to get a car model into OFP. Well, here it is:
Simple car model with textures.
So, you can either make your own model and use that for this tutorial or you can just download the one I made and start using that one. Download mine and this lesson will take a shorter time. If you make your own model sometime and are unsure on how to get in ingame, just run trough it again with your new model. But for starters, download my model.
When you have done that, open the p3d-model and have a look at how the model is put together. Its simple stuff. Just some resized box- and cylinder-structures with textures on them. Currently there are only two LODs there, “0.000” and Geometry. There LODs should already look familiar if you've read lesson 1.
The basic geometry is set up. I have selected some key structures, created selections them and applied some weight. Note that the geometry doesn't cover all structures of the original model (like the spoiler, whole seat etc). Its just because I didn't feel it was necessary for such a simple model in such a simple tutorial. So just leave the Geometry LOD the way it is.
Yes, that's right. Its already time to test our model in-game! And for those of you who have downloaded my model didn't have to do any real work at all! To test the model do this:
Now if you have tested it you might have noticed that its pretty crappy right now. The steering wheels wont turn, you don't see the driver, impossible to see anything in first person view, the thing seem to jump/stutter on the ground and, hell, even the wheels don`t turn. This is what we are going to fix during this tutorial.
Now you might wonder how our model suddenly became a real functional OFP car just like that. And if you look closer on the model you`ll see that its not that much separating your car model from that silly crate-model we made in tutorial 1. So how did this happen? The answer lies in the config-file:
The important part of the config-file, the “Firstcar” class.
Now tricks or magic. Its just that our car has a different config-file than our crate. And a much bigger and confusing one. Many features and settings that no doubt will make the newbie feel a little down. But fear not, its not that hard. Lets have a look at the important settings:
There are some other features that we`ll look at when the time is right, but these are the important ones right now. If you are somewhat experienced in object-oriented programming you`ll see that while our crate was classified as a static object, our car is classified as a LandVehicle of some sort, and then I have “stolen” the Jeep class. Then I just have to set a few important attributes and get the rest for free. Inheritance at work! I'm not going to give you a lesson in config-file making, so I wont go into any detail about why and how each setting work. Find a config-file tutorial at PMC Editing Wiki if you really want one.
What I can say it that I've stolen most of the standard West OFP Jeep attributes. Right now the physics model (braking distance, damperforce, turnradius, etc) are exactly the same as the West→Car→Jeep in OFP editor. Get the “Commended Config” files from Bohemia Interactive Studio: Breathe if you really must know all the details about the jeep. Other just ignore this info for now.
So, now lets get our model in shape.
First thing first, lets make the wheels turn! That is probably the most stupid thing with our model right now. All wheels turn, don't they? (Except for the spare one, I guess :) ).
To make them turn, OFP must know were your wheels is. We do that by selecting each wheel structure and define a pre-set selection for them in the main LOD, “0.000”. Simple really, the bad thing is that you have to write the selections in Czech! Jep, that's true, but don't worry, I will give you all the details you need. Here we go:
Its the same way for all the wheels, just with different names for each wheel. Select a wheel, define a selection with the right name. Simple. Here is the final pic with names for all the wheels:
And now you can test your model again. Note that all wheels are turning (if you named them right, that is. No typo`s). Also, the front wheels are steering when you steer! Great, isnt it? But there is still much to be done. Lets move on.
Next one is very important for the physic model.
For all moving objects, OFP will like to know which parts of the model is in contact with the ground. What we need to do is to place out 4 vertices, one under each wheel. Then select and name each vertex with more czech gibberish :). Lets move:
Now you know how to do that. You must place one vertex under each wheel, so use the info above on how to do place the last 3 vertices. It should look like this afterward:
Now we have to do the same thing as the last page, select one at the time and define a selection for it. Select the front right vertex, make a new selection and call it the right name, etc. Here is the selection names:
Done with that. Good. Now things like dampers will work properly and should eventually give you a much more smoother ride. But we arent done yet. Next one then.
Well, we got the dampers working, but ofp isn't quite satisfied yet. It also need to know more about the wheels and how it interacts with the ground. More vertex placing and selection-naming I am afraid.
There is a total of 8 vertices to place, two for each wheel. But unlike the last page where we placed one in the middle under each wheel, we need one at each wheel edge. Lets move:
Now a same pair of vertices should be placed under the last 3 wheels. Do this now. Then select each vertex (one by one, not pairs!) and make a save selection for each of them. See picture for all the selection names.
Now that's done. It is hard work, I know, keeping all the PPLs and ZLL under control. Don't worry if you screw it up the first time, but keep trying until you get it right. When done, test if you want and move to next page.
The steering wheel on our model doesn't turn whit the wheels. We`ll change that. Lets go.
But that aint enough to make it work properly. It needs an axis to spin around. And we need 2 vertices to do that:
Both selected to show the better in pic. Green lines added to indicate axis.
OK, if you compile and test now, the steering wheel should work fine. One thing though, note that we used a structure with a texture on it as the steering wheel. Usually people use a texture with a transparent background color. That way you can have more realistic steering wheels. But that's a bit harder to do and not for this tutorial. We keep it simple, don't we?
Even when there is someone in the car, no model of the driver sitting in the seat is shown. We will fix this now.
But we need to have a serious chat first, and its about proxys. A proxy is a “model in the model”. You simply put an driver 3pd model into our car p3d model to see how we should place the driver in its seat. Do this:
A triangle made of 3 vertices should show up. This is the driver model proxy in o2.
But if you have a look at Bulldozer, the full driver model will be shown. The driver model wont be added to your car-model or the final PBO, its just there for reference. Ingame, OFP will find the driver model in its own data3d folder. But this will help your in placing your driver correctly. And no, the proxy model doesn't have textures.
Select the driver proxy (triangle) using F2. We need to rotate and move it to make the driver sit in the seat. You should be able to do this by your self, rotating and moving was learned in lesson 1. When you have the driver roughly in the seat, use o2 to make small adjustments to the proxy position and use bulldozer to see how it looks. (You might have to tilt it a little to get more room for his feet!) Try to make the model sit nicely in the seat, like this:
Drivermodel rotated and moved into right position.
Now, compile and test it. If your`re not happy with the placing of the driver, load up o2 and try again. Move on to the next lesson when your`re done.
Lets make space for a passenger, shall we? Well will extend the seat (like a coach), move the steering wheel to the side and add a proxy model for the passenger. We`re off:
It should look like this in Bulldozer.
Now we need a proxy model of the passenger. And there happens to be another p3d model of a passenger called JeepCoDriver.p3d inside that ZIP your got from the start of the tutorial. Find it and put it in the same folder as the last one (Data3d in Bulldozer).
Now we do the same thing as for the driver proxy and your should be able to do that easy if you understood the last page. Remember to write “JeepCoDriver” instead of driver when you add the proxy. Then rotate and move it into position using Bulldozer to check how it will look ingame. Here is how it should look:
When your`re happy, WAIT, don't compile yet! No no! There is something we must do first:
Both vertices selected to help seeing them
So, test time yet? Nope, but we`re almost there. We must do some changes to the configfile to allow our car to carry passengers.
Compile the thing, check that getting in/out works for both driver and passenger etc. NOTE: If the get in/out doenst work properly, try moving the “pos driver” or “pos cargo” vertices up or down. I solved a problem like that by zooming in and moving them closer to the red line. Experiment with the height a little if you run into problems.
Nice, huh? Next one, then.
Congratulations, if you made it this far, you now know the basics of making a car for OFP. And if the car hasnt made your OFP-version crash and burn, then be proud!.
Some may be disappointed now, saying like “it that it”?, and experts just stopping by crying out “Where is the stuff about Fire Geometry or Hitpoints”. Well, this is a basic tutorial and my goal was clear, to give you some basic skills in OFP car making. And now you`ve got it. Thus, Im tierd of writing.
There are many things yet to discover, like how to make glass for windows, proper hitpoints and fire gemoetry LOD, working instrument panels, front and brakelights, etc. Now the road ahead is open. You must head out to the forums, download LOADS of different car addons, break open their pbo file and analyze how the experts do it. I can personally recommend Mechanic's amazing vehicles. And you can download the finished tutorial model Brsseb_lesson2_done.rar.
Now just knock yourself out with your first car addon for OFP. Have some fun with it, drive it to it breaks down (head for the configfile and change the top speed to 600 or so, THAT is fun!).
Thankz for following this tutorial. As always I'm happy for all the feedback I can get at firstname.lastname@example.org (I'm on MSN almost everyday). Cheerz!
This tutorial was written by Brsseb in ofp.gamepark.cz/_hosted/brsseb/, it was posted here with his permissions, thank you Brsseb!