- a game configuration file that supports vehicle entities such as this one
- understanding of 3D space and dimensions
2. Creating an origin for the vehicleYou should already have made a car or at least something at this point. It should be made parallel to the X axis. Here's mine:
To make it work I need to specify the origin of the vehicle centered on the X and Y axes (so you can set length and width correctly). This is done by creating a brush in the middle of your vehicle (marked with a cross) with the origin texture
It doesn't necessarily have to be centered on the Z axis because you can change the height value of your entity later. So now I have something like this:
3. Creating the vehicle entityAt this point you can create a func_vehicle entity with the whole vehicle, origin included. From now on all keyvalues will be highlighted in red. These are the ones you should change:
The vehicle controls need to target this entity so set a name.
Name of the path_track entity the vehicle will spawn at in game, which we will create later.
Dimensions of the vehicle on the X axis. Once again, your car should be made front parallel to the X axis so you can set the length/width correctly.
Dimensions of the vehicle on the Y axis.
This defines how many units the bottom of the origin is above ground. This is useful if your vehicle has wheels, and very useful for boats or helicopters. Making the origin touch the ground and setting this to 0 is acceptable however don't do this due to the buggy nature of vehicles, how they move up slopes etc.
This is how my car looks like so far in the XY graph:
Also my car now faces negative X because of incorrect orientation in-game. the angles value doesn't seem to do anything for me.
There are also settings such as speed, sound, damage and other gimmicks. These will be explained in the end.
4. Creating tracks for the vehicleNow we will make the path_track entity we mentioned earlier. I want the vehicle to spawn closer to my player start to that's where I will create the entity:
There are just two values you need to change for this entity. Remember, it will be targeted by the vehicle so set the targetname value correctly.
This entity will target another path_track entity which defines the point the front of the vehicle will be facing. Set a name and create that one now.
The second path_track must in turn target the first path_track entity. All in all, the first track is where the vehicle spawns, the second track is the direction it will start out facing in-game.
5. Creating vehicle controlsLastly, we need a way to control the vehicle. Make a trigger brush on the drivers seat or above the vehicle or whatever and make it a func_vehiclecontrols.
Make the vehicle controls target the vehicle and that's it, you have a working car. Compile the level and test the car out in game.
If you have an problem or issue, download the vehicle I've made and see how it works. If you're still stuck, post a comment and I'll try to get back to you.
6. Misc settingsbank
This defines how many degrees the vehicle tilts when cornering. This is good for motorcycles and adds a realistic banking effect.
Damage dealt to a player who got ran over or crushed by a car. Realistically this should kill the player instantly so set this to something high such as 10000
The speed of the vehicle in units per second. 500 is a good starting value.
The velocity of the vehicle as soon as the level loads in-game. The vehicle will immediately decelerate to a stop. This is generally left alone or set to 0.
The sound of the vehicle. This must be an integer ranging from 1 to 7. You can find the vehicle sounds in cstrike\sound\plats\
The volume of the engine. This must be an integer ranging from 1 to 10, with 10 being the loudest.