Create a cube Blueprint and rotate it using Skookum
Remember that you can download the tutorial project here. This tutorial uses map Level1.
Check out the video version here.
1) Start a new project that uses
Starter Content (I chose First-person template for this one).
2) Navigate to
Geometry/Meshes in the Content Browser. Right-click
Asset Actions >
Create Blueprint Using This.
3) Let's call it
4) 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
5) Add a
SkookumScriptClassData component (Add Component menu in the upper-left corner of our
6) 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!
7) Navigate (in your Content Browser) to
Blueprints and drag 'n' drop our cube into the world somewhere. Make sure it's nice and visible.
8) Save your current level, switch back to the
BP_Cube window and hit the button in the toolbar (Show in IDE).
9) 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.
10) 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.
11) Use the
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).
12) 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
13) 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.
14) Hit F7 to compile (or ALT-F7 to compile current class & subclasses; usually faster).
15) 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!