镜头第三人称旋转

一.

1.相机不基于  Controller 旋转,角色自身也不 基于 Controller 进行旋转。

	CameraBoom->SetupAttachment(MyRoot);
	Camera->SetupAttachment(CameraBoom);
	CameraBoom->TargetArmLength = 300;
	CameraBoom->bDoCollisionTest = false;
	Camera->bUsePawnControlRotation = false;
	// Don't rotate when the controller rotates. Let that just affect the camera.
	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = false;
	bUseControllerRotationRoll = false;

2.让相机臂 可以 使用 基于Controller的旋转。

CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller

3.区别一个知识

.bOrientRotationToMovement 

官方解释:

If true, rotate the Character toward the direction of acceleration, using RotationRate as the rate of rotation change.
改为false后人物不会自动向移动方向旋。

需牢记 若使用 二者 则bUseControllerRotationYaw 与 bOrientRotationToMovement 布尔值要相反 作者:是蛋黄蛋 https://www.bilibili.com/read/cv19334054/ 出处:bilibili

二.绑定输入输出,旋转

// Called to bind functionality to input
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);
	InputComponent->BindAxis("MouseWheel",this,&AMyPawn::Zoom);
	//MouseXY
	InputComponent->BindAxis("MouseX", this, &AMyPawn::RotateX);
	InputComponent->BindAxis("MouseY", this, &AMyPawn::RotateY);
}
void AMyPawn::RotateX(float value)
{
	if (value != 0)
	{
		AddControllerYawInput(value);
	}
}



void AMyPawn::RotateY(float value)
{
	if (value != 0)
	{
		AddControllerPitchInput(value);
	}
}

三.在蓝图里也可以直观感受到。

Pawn设置,Pawn就不会跟着弹簧臂转。勾哪一个轴就跟着,那个轴就更着转。

CameraSpringArm

Camera这个true,false好像不影响,在子节点绑定到Arm上,但最好就false吧。

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值