UE4虚幻,在C++脚本中添加AxisMapping轴映射,ActionMapping操作映射。

在c++脚本中添加轴映射,操作映射。不是绑定映射

UPlayerInput::AddEngineDefinedActionMapping(FInputActionKeyMapping("SpeedUp",EKeys::LeftShift));			//添加ActionMapping动作映射

PlayerInputComponent->BindAction("SpeedUp", IE_Pressed,this,&APawnWithCamera::SpeedUpIn);
PlayerInputComponent->BindAction("SpeedUp", IE_Released,this,&APawnWithCamera::SpeedUpOut); //绑定ActionMapping动作映射



UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("Turn", EKeys::MouseX, 1.0f));        	//添加AxisMapping轴映射
PlayerInputComponent->BindAxis("Turn", this, &ACameraCharacter::OnTurn);            //绑定AxisMapping轴映射

猜你喜欢

转载自blog.csdn.net/qq_39934403/article/details/109000301