Time for action – Using rotators
Before we use rotators on our AwesomeActor
, we need to add some visual clue to let us know that it's actually rotating. To do that we're going to add another bit to our default properties like the sprite, but this time it will be an arrow we'll be able to see in the editor.
Below the sprite in the default properties, add this:
Begin Object Class=ArrowComponent Name=Arrow End Object Components.Add(Arrow)
We're going to log our actor's current rotation, so inside our
PostBeginPlay
add this:'log("Rotation:" @ Rotation);
Our class should now look like this:
class AwesomeActor extends Actor placeable; function PostBeginPlay() { 'log("Rotation:" @ Rotation); } defaultproperties { Begin Object Class=SpriteComponent Name=Sprite Sprite=Texture2D'EditorResources.S_NavP' End Object Components.Add(Sprite) Begin Object Class=ArrowComponent Name=Arrow End Object Components.Add(Arrow) }
Compile and take a look in the editor. Our actor now...