How to rotate character when pressing button?

how to rotate character in “free mode” when pressing certain button?

Your question is either too easy or not clear enough. It’s so basic, that you can find it in any Example Project.

Create a FPS Example Project and look at FirstPersonCharacter:

  • Add an Axis Input for your key, call it something like “Move Right”
  • In your character BP, add an Input Move Right node and plug it into an “Add Movement Input”
  • As Input for World Direction, you use “Get Actor Right Vector”

No I mean like how assign rotation in a button for exaomple alt button and the character camera will only to be able to rotate when pressing the button?

From what I understand, you only want the action to work when a key is pressed, right?

So In this case the Gamepad button will only work (output true) if Left Alt is currently pressed down.

http://puu.sh/kBBHv/6871ac62f9.png

wow thx for help! :slight_smile: Testing this method right now :slight_smile:

I mean like this Screen capture - 7d0fbe89c18aa5e3ea9248db68751835 - Gyazo when button is pressed and when un-press the button it uses rotation pitch,controller rotation yaw and controller rotation roll.

You may want to check out the info in this thread,
in particular the axis mappings.

This will make the input action happen for every frame.

After that it is just a case of using a AddActorWorldRotation node to move the camera
and a Make Rotator node to create your rotation values.

Based on your comments: What you want to do is controlling the camera instead of the character rotation while pressing a special key.

So you need to combine what I said with the DANjustYEAH’s blueprint-screenshot and the fact that you can enable/disable the camera’s ability to follow the controller rotation (which should be on a spring arm).
There is an AnswerHub Question about this camera property here.

I’m not gonna post a full solution here, but you need something like this:

  • Setup the character as DANjustYEAH said
  • when the button is pressed, you enable/disable the ‘Use controller view rotation’ (disabled means it is locked on the character, enabled means the camera is free to move) on the camera.
  • While free camera mode is enabled, do not call the “Add Movement Input”, so the character itself does not rotate.