-
Notifications
You must be signed in to change notification settings - Fork 3
Vehicle Movement
Once you have the assets of your vehicle you are ready to use it in the game. To do so you need a Pawn.
Let's take as example Blueprints/Vehicles/Sedan/SedanBP.uasset, that BP inherit from AReplayVehiclePawn which is ABaseVehiclePawn which is a AWheeledVehiclePawn. AReplayVehiclePawn and ABaseVehiclePawn are just C++ classes I made for my game to manage some extra stuff.
If you just want a very base and simple vehicle you could inherit directly from AWheeledVehiclePawn which is the Unreal class. This is already done for example in the Vehicle Template project by VehicleTemplate/Blueprints/SportsCar/SportsCar_Pawn.uasset, as that project is 100% BP.
To manage some settings you need to create the wheels asset, which determine the mesh of the wheel, the radius, suspensions, and a lot of other parameters you can configure as you desire.
This is the example of the asset for the rear wheels of the sedan.
The wheel asset is connected to the mesh bone name inside the Vehicle Movement Component of the Pawn.
Look at this example of AmbulanceBP.
The Vehicle Movement Component is the main component present inside the BP, added by AWheeledVehiclePawn which control the whole movement of the vehicle. It contains a tons of parameters and curves you can configure, such as: torque, steering, suspensions, braking and engine setup.
An important thing for a Vehicle is the center of mass. By default this is probably in the middle of the mesh, which is too high and will make the vehicle roll too easily. All of the Vehicles in the project override it.
It is possible to visualize it using p.Vehicle.ShowCOM 1
as explained in the Vehicle Debug Commands-
The Vehicle Controller of my game is made in C++, but what it does it is exactly the same as the Vehicle Template, it read the input and sends it to the Vehicle Movement Component.
The vehicles in my game sometimes have some BP code to control the emissive materials of the brake lights.
This is inspired by the Vehicle Template project which does the same thing.
//Footer
This documentation describes only a small part of the project, in which you can find the basis about how to navigate and edit it. 🚚
If you would like to know more about a part of the project, how to do something, or if a part of the documentation is not correct/incomplete/out of date, please feel free to open an Issue or a Discussion.
Thank you for reading the Wiki!