Create a Game Object
With the C++ class defined, we can now place our game objects. The first step is to create a square class from our shape subscriber C++ class. Navigate to the shape subscriber C++ class in the content browser, then right click and select “Create Blueprint class based on ShapeSub”.
Give the new blueprint class a name. We use SquareSub as this is an instantiation of a shape which we will use in the project. You can place the new class in the content folder.
Now you will see the new SquareSub blueprint class in the content folder. You can drag it onto the viewport and place it anywhere you like. The position will automatically be updated when running, so the exact location doesn’t matter.
In the details view, you can configure the square. First set the Static Mesh to a 100x100x100 cube. We also recommend setting the scale to 30% (0.3) for all 3 axes.
Now the static mesh can be set. Since the default is a blue square, select the blue only material.
The Connext settings are set to Square and domain zero which works as default for this.
Now click play and go to the Shapes application to publish a blue shape. You should see the blue square moving.
Notice that the cube will not move in the same direction as the blue square in Shapes. The reason for that is that the origin (0,0) for shape is in the top left corner, and positive Y values mean that it is further down from the origin. Whereas in Unreal Engine, the origin is around the bottom left and positive Z axis values mean it is further up.
There are a few other issues as well. The blue cube will move regardless of what color square is being published by Shape. The reason for that is that in Unreal Engine we “just” subscribe to the square topic but don’t manage instances. The other issue is that right now, each instance in the game will create its own participant and reader. We will address those issues in the next few sections.
Extra Credit: Create a circle subscriber in Unreal.
Module 6 Demo:
This video covers the steps for Module 6.