Mouse input doesn't work

I’ve begun, to set the input in code. The WASD and Space Bar works, but the mouse doesn’t work. I cannot turn the character, not even aim or fire. I wrote: InputComponent->BindAxis(“Turn”, this, &AMyCharacterClass::AddControllerYawInput);. I made the same in blueprint, but it’s the same. What should I change? Thanks!

1 Like

Does your DefaultInput (Found in ProjectName->Config->DefaultInput) file contain:
+AxisMappings=(AxisName=“Turn”,Key=MouseX,Scale=1.000000)

This can also be set in the Editor through Project Settings-> Input

I think this works, but you cannot see any effects. First check if your controller rotates. Run game, hit ~ and type “DisplayAll PlayerController Rotation”. Value should be displayed on the top of a screen as a text line, then move mouse to check if it changes.
If this works, make sure that your character/camera boom/camera have bUsePawnControlRotation flag set. You should also set this flags: bUseControllerRotationPitch, bUseControllerRotationYaw, bUseControllerRotationRoll.

Check on the Project Settings → Input on Axis Mapping if you have Turn mapped to Mouse X. If you do, put a breakpoint on the AddControllerYawInput to see if it triggers. If it does, there should be something wrong with you logic in that function.

Thanks! I’ve changed the ControllerRotation settings, and now I’ve forgot to set it back. Thank You!