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/Meshesin the Content Browser. Right-click
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
StaticMeshcomponent and turn off
Save & compile
BP_Cube(you’ll notice that the SkookumIDE will also auto-compile). It has just created a
BP_Cubeclass for you on the Skookum side!
Navigate (in your Content Browser) to
Blueprintsand 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_Cubewindow and hit the button in the toolbar (Show in SkookumIDE).
This is where we can add subclasses, routines / coroutines / constructors / destructors and data members to our highlighted class. Type in
!to create a constructor and hit Enter or press the
Use the New Class or Member pane one more time and type in
_rotatewhich 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
() [ loop [ !r : RotationAngles!yaw_pitch_roll(100.0 * GameLib.world_delta_seconds 0.0 0.0) add_actor_world_rotation(r) _wait //wait until the next frame before executing this loop again ] ]
And now all that remains to be done is calling our coroutine from inside our constructor as so
() [ branch [_rotate] ]
More info on the
Run the game and Bob’s your uncle, mate!