Create a cube Blueprint and rotate it using Skookum
Remember that you can download the tutorial project here. This tutorial uses map Level1.
Start a new project that uses
Starter Content (I chose First-person template for this one).
Geometry/Meshes in the Content Browser. Right-click
Asset Actions >
Create Blueprint Using This.
Let’s call it
You now have a BP that holds a static mesh of a cube. You may choose to apply a material to the cube so it’s more visible in the stage but that’s completely optional. I usually go with
M_ColorGrid_LowSpec. More importantly, make sure to select the
StaticMesh component and turn off
Enable Gravity under
Save & compile
BP_Cube (you’ll notice that the SkookumIDE will also auto-compile). It has just created a
BP_Cube class for you on the Skookum side!
Navigate (in your Content Browser) to
Blueprints and drag ‘n’ drop our cube into the world somewhere. Make sure it’s nice and visible.
Save your current level, switch back to the
BP_Cube window and hit the button in the toolbar (Show in IDE).
This will take us to the
BP_Cube class in the Skookum Browser. Make sure the class is highlighted and click the
Add a Class/Member bar underneath the member list. Read the dialog popup that shows up and hit OK.
This is where we can add subclasses, functions, coroutines, data members, and constructors/destructors to our highlighted class. Type in
! to create a constructor and hit Enter.
Add a Class/Member dialog one more time and type in
_rotate which will create a coroutine with that name. This is where we’ll have our code for rotating the cube. (We could have just added the code to the constructor itself but it’s generally a good rule of thumb to keep constructors tidy and brief).
Our code to rotate the cube will look like this inside
!r : RotationAngles!yaw_pitch_roll(100.0 * GameLib.world_delta_seconds 0.0 0.0)
_wait //wait until the next frame before executing this loop again
12) And now all that remains to be done is calling our coroutine from inside our constructor as so
More info on the branch command here.
13) Hit F7 to compile.
- Run the game and Bob’s your uncle, mate!
Special thanks to @Gigantoad for suggesting the basic problem and to @error454 for suggesting a solution!