I Add Animation to Character.
Everything is fine. But SkeletalMesh rotate with sight rotation(mouse input).
293205-
like this.
When I try to see upside, Mesh rotate.
This is code of Character’s constructor and some of sight rotate function
ATHCharacterBase::ATHCharacterBase()
{
......
FPCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
FPCameraComponent->SetupAttachment(GetCapsuleComponent());
FPCameraComponent->SetRelativeLocation(FVector(-39.56f, 1.75f, 64.f));
FPCameraComponent->bUsePawnControlRotation = true;
FPCameraComponent->SetFieldOfView(90.0f);
GetMesh()->SetRelativeLocationAndRotation(FVector(0.f, 0.f, -100.f), FRotator(0.f, -90.f, 0.f));
GetMesh()->SetupAttachment(FPCameraComponent);
GetMesh()->SetOwnerNoSee(true);
GetMesh()->SetIsReplicated(true);
.....
}
void ATHCharacterBase::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
.......
PlayerInputComponent->BindAxis("Turn", this, &ATHCharacterBase::Turn);
PlayerInputComponent->BindAxis("LookUp", this, &ATHCharacterBase::LookUp);
}
void ATHCharacterBase::Turn(float val)
{
AddControllerYawInput(val);
}
void ATHCharacterBase::LookUp(float val)
{
AddControllerPitchInput(val);
}
I don’t know what’s the problem. please tell me what’s wrong.