Unreal Engine Blueprint – Rotate an object using a key (Part 2 of 2)

This post is part 2 of a previous post on rotating a cube (or any object) without an event tick, but this time we will use a key input to stop or start an object from rotating.

In the same blueprint that was created in part 1 go into the Event Graph and follow the steps below.

Enable player controller so the object rotation can be enabled or disabled with a key.

  1. In the component section add a ‘box collision’.
  2. Scale this to the required size and make sure your character is able to enter this box.
  3. The other components required have already been added in part 1.


  1. Make sure the RotatingMovement component has Auto Activate unticked.
  2. To do this select the RotatingMovement component and in its details panel (right hand side) search for ‘Auto Activate’ and untick the box.
  3. If you don’t the object will just rotate from the start of the game or if you want to rotate from the start – keep this box ticked.

In the Event Graph:

  1. Search for ‘Get Player Controller’
  2. Drag off from this node – from the ‘Return value’ and Search for and add ‘Enable input’.
  3. Repeat step above but this time search for and add ‘Disable input’.
  4. Make sure the ‘Return value’ is plugged into ‘Player Controller’ and not ‘Target’ (see image below).
  1. Select the Box collision.
  2. On the right hand side details panel scroll down and select ‘On Component Begin Overlap’
    1. Pull off the top socket execution node (white arrow) and plug into the ‘Enable input’
  3. Repeat step above and select ‘On Component End Overlap’
    1. Pull off the top socket execution node (white arrow) and plug into the ‘Disable input’

Now the player controller will be activated when the player enters the collision box.

player controller activated blueprint

Adding the Key Input:

  1. Right click and search for the E key (or use whatever key you want to use as it doesn’t have to be the E key).
  2. From the E key drag off from ‘Pressed’ and search for Branch.
  3. Add a branch > Where it says condition right click and select promote to a variable.
    1. Rename variable to Activate (this is a Boolean) and we are adding this so the branch knows what path to follow). 
    2. The E key will only connect to one node so it needs some logic to function like a switch.
  4. Press compile and make sure the Activate value is ticked in its details panel on the right hand side (see image below).


  1. Drag off from True and search for Activate (with RotatingMovement).
  2. When selected it will auto add the Rotatingmovement component into the event graph.
  3. From the Rotatingmovement component drag off and search for Deactivate (with RotatingMovement).

Setting the Boolean:

  1. Finally, from the variables panel on the right hand side there is the Boolean variable that we called activate.
  2. Drag off this varaible and place after activate > select Set and then plug in the Activate node.
  3. Repeat step above but this time tick the Activate box. 

The reason we have done this is so when pressing E (inside the collision box) it will first follow the True Activate Branch and its final state will be to deactivate the switch (as we have not ticked the box).

When the E button is pressed again, now it will follow the false branch (as it was was deactivated or set to false) and it will follow the path to the Deactivate node and the rotation will stop. Finally it will be re-activated as the last Boolean is ticked. This logic is also used for light switches or turning on or off a music player.

Remember to scale the collision box to the appropriate size so your character can enter it and press the E key to activate the rotation. Below I swapped out the cube for a large metal sculpture of the world. 

This blueprint is now ready to work in the level and you can place it where ever it is needed. For further tutorials on blueprints see the tutorials and tips page or if new to blueprints have a look at the Introduction to blueprints page.

If you have any questions or got stuck please do leave a comment in the comments section.