Create a cube Blueprint and rotate it using SkookumScript
SkookumScript UE4 Plugin Basic Tutorial 1
-
Create a new UE4 project that uses Starter Content.
-
Select the First-person template.
-
In the UE4 Editor Content browser, navigate to Geometry/Meshes. Right-click 1M_Cube > Asset Actions > Create Blueprint Using This.
-
Name your new Blueprint
BP_Cube
.
You now have a Blueprint that holds a static mesh of a cube. You may apply a material to the cube so it’s more visible (M_ColorGrid_LowSpec is a good choice), but this is completely optional.
-
Select the StaticMesh component.
-
Under Physics, turn off Enable Gravity.
-
Save and compile
BP_Cube
. (Note that the SkookumIDE will also auto-compile).
Your new BP_Cube
class will appear in the SkookumIDE Classes widget.
-
In the UE4 Content browser, navigate to Blueprints and drag our cube into the world somewhere. Make sure it’s nice and visible.
-
Save your current level.
-
In the toolbar of the
BP_Cube
window, click the [Sk] (Show in IDE) button. This will take us to theBP_Cube
class in the SkookumIDE Classes widget. -
Ensure sure the class is highlighted and click New Class or Member at the bottom of the Members widget. (If a “Skookify your project?” confirmation message appears, click OK.)
The New Class or Member pane is used to add subclasses, coroutines, data members, and methods to our highlighted class. In this case we will create a constructor method.
-
In the New Class or Member pane, create a constructor by typing
!
and pressing Enter. -
Now create a coroutine by typing
_rotate
and clicking Add.
Your new _rotate
coroutine will display in an Editor widget. This is where we’ll put our code for rotating the cube. (We could have just added the code to the constructor itself, but it’s a good rule of thumb to keep constructors brief and tidy).
- Now we’ll add the code for rotating the cube. In the
_rotate
Editor widget, paste in the following code:
- Now we’ll call our coroutine from inside our constructor. Select
!
and paste in the following code:
-
Press F7 to compile.
-
Run the project, and voilà! Behold a rotating cube!
Stay Skookum!
Special thanks to SkookumScript user @Gigantoad
for suggesting the basic problem, and to @error454
for suggesting a solution!
Next » SkookumScript UE4 Plugin Basic Tutorial 2: Spawn cubes dynamically and manipulate them
« Previous SkookumScript Intro Tutorial 1: Create and modify a method in SkookumScript