Editor: Creating a Spacecraft Blueprint
Description
Spacecrafts are the heart and soul of Nominal Editor, being the object that contains components and orbits around celestial bodies. This operator guide showcases how to create a Spacecraft
Blueprint from scratch, how to add components to it and how to spawn it in a simulation.
Learning Outcomes
- Create a Spacecraft blueprint from scratch.
- Add components onto the spacecraft.
- Add the created spacecraft into the simulation.
Instructions
Creating the Spacecraft blueprint
We’ll start by creating the spacecraft blueprint. Right-click an empty space on the content browser and select Blueprint Class
.
We’ll now choose the parent class of the blueprint. In the bottom half of the new popup, search for Spacecraft
and select it. This chooses what the blueprint will inherit from and in this case, we want to inherit from the base C++ Spacecraft
class. Most blueprints will denote “BP_” as the prefix as that's the standard Unreal naming convention.
Give the new blueprint a name with the prefix “BP_” to follow Unreal’s naming convention and to quickly identify that this object is a Blueprint. Lastly, open it up.
Note
There’s an icon on the top right of the blueprint due to source control being configured. If you don’t have it configured, there will be no icon.
Adding components to the blueprint
Click on Add Component
and then select Child Actor
. This will create a child actor on the root component. The reason why we do it this way is so you can add prebuilt components we have provided and for easier reusability.
This actor will be the Chassis so we’ll rename it as so.
On the details panel (default is on the right), select the Child Actor Class
dropdown and select a BP_NS_Chassis_3U
. This will set the child actor to become a copy of the selected actor class.
Select the Chassis
in the components panel and add another child actor called Solar Panel. This will make the Solar Panel a child of the Chassis and have its transformation relative to the Chassis.
Select BP_NS_SolarPanel_3U_XY
for the Child Actor Class
. The default transform of the spacecraft will be lying horizontally so update its transforms to have it upright and its Z-axis(blue) facing the outside of the Chassis.
You can also modify a component’s variables, for a solar panel its area, efficiency and self-shadow under Child Actor Component > Nominal Systems in the details panel.
Once you’ve finished editing the spacecraft, make sure to compile and save to ensure there are no issues and the editor can use this blueprint.
Spawning a spacecraft in a simulation
Create a new level and open the Level Blueprint
. Then Right Click anywhere and create a Spawn Actor From Class
node.
Select the Spacecraft
actor to be created in the Class
dropdown. The node will now spawn the selected actor.
Link up the BeginPlay
Exec pin (white) to the Spawn Actor from Class
node. Then right-click on the Spawn Transform
pin and select Split Struct
Pin. This is required as Unreal will throw an error if the Spawn Transform
pin is null. An alternative method is to create a transform and pass it in.
Warning
It is not recommended to modify the spacecraft using the Spawn Transform values.
Drag from the Return
value and select Set Classic Elements
to give the spacecraft a basic orbit, otherwise, the spacecraft will spawn in the centre of the Earth.
Hit Play and you’ll see your spacecraft in orbit around the Earth. It’s not moving as we aren’t ticking the simulation in this guide.
Creating a spacecraft on top of an existing one
Create a new blueprint and when selecting the Parent class, instead of selecting Spacecraft
select an existing blueprint with a “BP_Spacecraft” prefix. This would make the Parent class a blueprint instead of a C++ class and inherit all its components.
Open the spacecraft up and you will see the components in the Parent class listed as Inherited. Modifying anything here will not affect the parent class and allow you to quickly build and modify a new spacecraft.