Add an Earth actor
At the moment the orbital centre of our scene is empty space. It might help to represent the Earth to-scale for spatial context. Here's what we'll be adding to our scene:
π Setup a new Actor
Create a new Earth folder in your Content Browser and Add New β Blueprint Class named Earth. This actor is simply a "wireframe" mesh with a black sphere inside to block our view to the other side.
Setup components
This actor only needs two StaticMesh components. Add these and title them Sphere and Wire, and make sure they're next to each other heirarchically (not attached to either).
For both, set the Collision Presets option to NoCollision.
Import a wireframe mesh
You're welcome to create your own wireframe mesh shape, or use ours by downloading the file below and importing it into your project. If using this file, ensure your the Import Uniform Scale option is set to 100
.
Select your Wire component, and in the Details panel on the right, assign the Static Mesh option to your chosen shape. Before continuing, we need to quickly make two materials.
Create Earth materials
Create two new materials in your Earth folder. One titled EarthWireMaterial (for our wireframe), and the other BlackSphereMaterial (for our internal blocking sphere). For both materials, set the Shading Model to unlit, and pass a Constant3Vector into Emissive Color to set the colour.
Back to your Earth actor, set the Material option of your Wire component to EarthWireMaterial. Then, select your Sphere component, set the Static Mesh option to Sphere (from /Engine/BasicShapes
) and Material option to BlackSphereMaterial.
The Material option appears after you assign the Static Mesh option.
Scale your Sphere component to 12.7
on all axes to meet (close to) the edges of the wire. Your Earth actor should now look somewhat like this:
Add rotation movement
The last step of our Earth actor is to, of course, have the globe rotate over time! Head to the Event Tick node in the Event Graph. Here, drag in a reference to the DefaultSceneRoot component and attach a AddRelativeRotation node.
Identical to our calculations in the Satellite class, we need to first multiply Delta Seconds by 6
to equate 1 minute to 360ΒΊ. Then divide this by 1440 (seconds in one day, orbit period of earth). We then multiply this 100 to speed up the animation. Adjust this value as you wish but ensure it is in sync with the Satellite class.
π Add to your scene
Drag and drop your Earth actor from the Content Browser into your level viewport. This will bring it into the scene, but it drops into some odd place in space. We want it in the middle, so reset its position:
Set it to be at X: 0, Y: 0, Z: 0
Now run your project! You should be able to notice and slow and steady rotation.
Read on to integrate our DA Assets plugin and utilise our input devices.