Drone Model & Game Template

This section explains all the features of the Drone Model & Game Template available on the UE Marketplace. The drone model consists solely of Blueprints, which can be easily added to your scene for use. It also includes templates that can be used for configurators and racing games.

Drone Model

Operation of the drone model

(List of drone operations)

Key inputKey
Motor start/stopF
Up / DownE / Q
Left / RightA / D
Forward / backwardW / S
TurnMouse
Third-person camera switching1
First-person camera switching2
Truck camera switching3
Side camera display position switching4
Camera Up / DownC / V

Motor start/stop

To start the motor, press the ‘F’ key while the drone is stopped. The drone will start spinning its propeller after the motor is started, and all operations will be available.
To stop the motor, press the ‘F’ key while the drone is landing on the ground.

Up / Down

The ‘E’ key is assigned for upward movement and the ‘Q’ key is assigned for downward movement.
You can move up and down after starting the motor.

Left / Right 、 Forward / backward

The ‘A’ key is assigned to move left, and the ‘D’ key is assigned to move right.
The ‘W’ key is assigned for forward movement, and the ‘S’ key is assigned for backward movement.
You cannot move back and forth, left and right, unless you are in flight.
The judgement of the flight state is confirmed by the JudgeGround function in the Blueprint.
When moving forward, backward, left or right, the body will tilt.
The body tilt is implemented by the “BodyRotater function” in Blueprint.

Turn

You can turn by moving the mouse left or right.

Third-person camera switching

Use the ‘1’ key to switch to the viewpoint of the third-person camera installed behind the Blueprint.
The “Change Owner Camera” function in “CM_CameraControllComponent” is used to switch the viewpoint.

First-person camera switching

Press the ‘2’ key to switch to the first-person camera.
The camera for the first-person perspective is generated in advance in “Begin Play” of “CM_CameraControllComponent”.

The parameter “Front Camera” can be disabled by setting it to “False”.
The parameter “Front Camera Transfrom” allows you to fine-tune the generation position. By default, it is set to the entire surface of the drone.
The “Change Front Camera” function in “CM_CameraControllComponent” is used to switch the viewpoint.

Truck camera switching

Press the ‘3’ key to switch to the Truck camera.
This camera is fixed to the ground. The viewpoint always follows the drone. It assumes the perspective of the pilot.
The truck camera is generated in advance by “Begin Play” of “CM_CameraControllComponent”.

You can disable it by setting the parameter “Track Camera” to “False”.
The parameter “Track Camera Transform” is used to adjust the generation position.
The “Change Track Camera” function in “CM_CameraControllComponent” is used to switch the viewpoint.

Side camera display position switching

Use the ‘4’ key to switch the display position of the side camera.
Each time the ‘4’ key is pressed, the display switches in the order of lower right, upper right, upper left, lower left, and hidden.

右下
右上
左上
左下
非表示

The side camera is displayed after the motor starts.
Use the “Change Side Camera function” of “CM_CameraControllComponent” to switch the display.
The side camera uses a widget.
/Content/MMIX_DroneV4/DroneV4/UI/WD_DroneCamera

Camera Up / Down

Moves the viewpoint of the side camera. The ‘C’ key is assigned to move up, and the ‘V’ key is assigned to move down.
Parameter ‘CameraMoveMin’ sets the minimum value of the movement amount.
The parameter “CameraMoveMax” sets the maximum value of the movement amount.
Parameter “CameraMoveSpeed” sets the speed of the move.
The “Move Camera Capture function” of “CM_CameraControllComponent” is used to move the viewpoint.

Blueprints for drone models

Blueprints can be found in the following folder
/Content/MMIX_DroneV4/DroneV4/Blueprints/BP_DroneV4

Blueprint Structure

CollBodyDrone Collision
BodyStatic mesh on the body
BodyArm_XXStatic mesh on body arm (*1)
PropellerArm_XXStatic mesh on propeller arm (*1)
Propeller_XXPropeller static mesh (*1)
Trail_XXTrail Effect (Niagara Particle System) (*1)
BodyCameraCamera static mesh
SceneCaptureComponent2DScene capture component for side camera
SpringArmSpring Arm Component
CameraCamera for third-person view
FloatingPawnMovementComponents for movement. UE standard components
PropellerRotationComponentComponents that control the rotation of the propeller
CameraControllComponentComponents that control the camera
MaterialComponentComponents that control the material

*1 FL:Front left FR:Front right RL:Rear left RR:Rear right

Blueprint parameters

Drone body

[ Body Rotater ]
Default Relarive RotationInitial drone rotation value. Used to calculate the body tilt.
Rotate Max AngleMaximum angle to tilt when moving forward, backward, left or right.
Rotate SpeedMaximum speed of tilting when moving forward, backward, left or right.
[ Drone Param ]
Distance to GroundThe distance from the drone to the ground.
Used to determine if the drone is flying.
Effect DisplayShow/hide the drone’s Trail effect.

Camera Control Components

[ Track Camera ]
Track Camera TransformPosition of the track camera
TrackCameraTrack camera enable/disable switching
[ Scene Capture Component ]
CameraMoveMinMinimum vertical movement of the side camera
CameraMoveMaxMaximum vertical movement of the side camera
CameraMoveSpeedVertical movement speed of the side camera
[ Front Camera ]
FrontCameraFront camera enable/disable switching
FrontCameraTransformFront camera position

Propeller Rotation Components

[ Propeller Component ]
Propeller Auto StartAuto-start propeller rotation?
When set to “True,” the propeller will always rotate
regardless of whether the motor is started.
propeller Max SpeedPropeller rotation speed
AccelerationMaxTimeThe speed at which the propeller reaches its maximum speed.
DecelerationMaxTimeThe speed at which the propeller comes to a stop
PropellerSoundSound effects of propeller rotation

Material Components

[ Material Component ]
Material InstanceSetting up a material instance
Type NoIndicates “1:TypeA 2:TypeB 3:TypeC”
Color NoRepresents “1-4”

「Material Instance is defined as an array of type Map, where Key is of type Name and Value is of type Material Instance.

To identify the Material Instance to be used, create a Key string from “Type No” and “Color No”. Type No” is converted to a string by “No”, and “Color No” is edited to two digits with zero padding.
For example, if “Type No.” is “1” and “Color No.” is “2”, it will be “TypeA_02”.

In-flight judgment with the ground

To determine the flight status, the function “JudgeGround” in the Blueprint is used.
In JudgeGround, the distance to the ground is determined by LineTraceByChannel, and the Distance to Ground parameter of DroneParam is used as the distance reference.

Configurator Templates

Functional Description

This is a template for the configurator. The ability to change the material of the drone mesh is implemented by selecting the Type or Color button to change the drone material.
The sequencer “LS_Configurator” is used for the performance when the configurator is opened.

Blueprint Description

The UI of the configurator is defined by the following widget.
/Content/MMIX_DroneV4/Template_Configurator/UI/WD_Configurator

WD_Configurator

When the Type and Color buttons are pressed, their respective OnClicked events are called, and the “changeMaterial function” of the drone Blueprint “BP_DroneV4” and “CM_MaterialComponent” is called.
This complete does not save the changed “Type No.” and “Color No.”, but the actual implementation needs to keep the values in its own project.
However, the actual implementation needs to keep the values in its own project. For example, you can store them in a global location such as a GameInstance, and the drone in the game will need to use the values in that GameInstance to change the materials.

Race Course Template

Functional Description

This is a template for a drone race. A course for the drone to fly, and the ability to acquire items are implemented.

Course

The course is created with blocks for level design.

Item acquisition and scoring

Items are implemented in blueprints.
/Content/MMIX_DroneV4/Template_RaceCource/Blueprints/BP_Power

When a drone overlaps an item, the BeginOverlap event executes the item acquisition process.

It is possible to set the score for each item, which can be set in the Blueprint parameters.

Score設定

The value of the score is added to the score. The widget for scoring is shown below.
/Content/MMIX_DroneV4/Template_RaceCource/UI/WD_GameScreen

The process of adding scores is implemented in the level print, but in the actual game, you will have to implement your own GameMode.

タイトルとURLをコピーしました