Language:
Page Info
Tags:
Skill Level:
Engine Version:
Share
此中文页面内容对应的英文页面有后续更新,如需浏览最新文档可切换至英文页面浏览。

3 - Creating a Vehicle Blueprint

By now, you've created a few different assets (TireConfig Data Assets, Wheel Blueprints, and an Animation Blueprint) that we need to bring together to create a fully functional vehicle in Unreal Engine 4. In this step, we'll create the Vehicle Blueprint and use those previous assets we created and setup!

Creating and Editing the Vehicle Blueprint

  1. In the Content Browser click the Add New button, then select Blueprint Class from the menu.

  2. In the Pick Parent Class window, under All Classes search for "wheel" and then select WheeledVehicle.

  3. In your Content Browser the new Blueprint asset will be created. Make sure to give it a recognizable name so you can easily locate it later.

    newVehicle.png

  4. From the Content Browser, select and open your newly created Vehicle Blueprint.

    MyVehicleBP.png

  5. Click on the Skeletal Mesh Component named Mesh from the Components Window. Then in its Details panel, set the Skeletal Mesh selection box to your vehicle's own Skeletal Mesh asset.

    ComponentsWindow.png

  6. Set the Anim Blueprint Generated Class to your vehicle's Animation Blueprint that we created in the Step 2 of this guide.

    AnimBPandSkelMesh.png

  7. Go back to the Components window and select the Add Component button and select a Camera Component

    addCamera.png

  8. Use the Viewport in the Blueprint Editor to position the Camera where you would like it to be relative to your vehicle. In the image below, it is positioned behind, slightly raised, and tilted down towards the vehicle.

    cameraPlacement.png

  9. With the Camera component still selected, in the Details panel under Camera Settings disable the option for Use Pawn Control Rotation. This will lock the camera to its view direction rather than that of the Player Controller.

    cameraControllerOff.png

  10. Next, select the Vehicle Movement Component in the Components window.

    ComponentsWindow2.png

    In the Details panel under the Vehicle Setup section, expand the arrow next to Wheel Setups and for each wheel (0-3) set the following:

    • Set the Wheel Class to the Wheel Blueprint(s) you created.

    • Set the Bone Name to the name of the joint that should be controlled by the wheel.

      wheelsSetup.png

      The Bone Name in the above image is specific to this skeletal mesh. If you're using the Vehicle from Vehicle Game, you can use these specific Bone Names.

    The order you assign wheels has no bearing on if it is a front or a rear wheel, only the Bone Name and Wheel Class have any effect. For organizational purposes, it's best to do them in keep the wheels (front and rear) together.

    If you need more than 4 wheels, you can click the "+" icon next to the Wheel Setups property to add more.

End Result

At this point, assuming your vehicle is not substantially larger than a minivan, the default values will be a good starting point for you to move on to the next step in this guide where we'll setup the inputs and controls to properly test out the vehicle.

Tags