# USpringArmComponent doesn't move when bUsePawnControlRotation set to true

**URL:** <https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [July 31, 2023, 9:03pm UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319 "2023-07-31T21:03:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [July 31, 2023, 9:03pm UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/1 "2023-07-31T21:03:59Z")

</div>

Hi!

I’m using this in my character class:

```auto

ASCharacter::ASCharacter()
{
	PrimaryActorTick.bCanEverTick = true;

	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = false;
	bUseControllerRotationRoll = false;

	SpringArmComp = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArmComp"));
	SpringArmComp->SetupAttachment(RootComponent);
	SpringArmComp->TargetArmLength = 400.0f;
	SpringArmComp->bUsePawnControlRotation = true;
	
	CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComp"));
	CameraComp->SetupAttachment(SpringArmComp, USpringArmComponent::SocketName);
	CameraComp->bUsePawnControlRotation = false;

}

void ASCharacter::BeginPlay()
{
	Super::BeginPlay();

	//Add Input Mapping Context
	if (APlayerController* PlayerController = Cast<APlayerController>(Controller))
	{
		if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
		{
			Subsystem->AddMappingContext(DefaultMappingContext, 0);
		}
	}
	
}

void ASCharacter::Look(const FInputActionValue& Value)
{
	FVector2D LookAxisVector = Value.Get<FVector2D>();

	if (Controller != nullptr)
	{
		// add yaw and pitch input to controller
		AddControllerYawInput(LookAxisVector.X);
		AddControllerPitchInput(LookAxisVector.Y);
	}
}

void ASCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

	if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
	{
		EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ASCharacter::Move);
		
		EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &ASCharacter::Look);
	}

}

```

But it doesn’t turn or look up, but it moves.

Have I forgotten anything?

I have no idea about enhanced input, so I have copied the code from the Third Person Template.

Thanks!

---

<div class="post-metadata">

**Author:** ![gardian206](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gardian206](https://forums.unrealengine.com/u/gardian206)\
**Post date:** [August 1, 2023, 9:00am UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/2 "2023-08-01T09:00:37Z")

</div>

are you using Mouse, gamepad, or keyboard buttons for look? Same question for the Move?

make sure you have an `InputAction` for your Look and make sure that the settings for the axis are “as expected”

- Y positive is a “Swizzle”
- Y negative is a “Swizzle” and “Negate”
- X negative is a “Negate”

did you remember to assign the `InputAction`s in the Blueprint for the Character (I hope you are not using hard, runtime resolved references)

I am unsure you mean by “doesn’t turn” do you mean that the character model doesn’t rotate? that the camera doesn’t orbit the character?

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [August 1, 2023, 9:41am UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/3 "2023-08-01T09:41:04Z")

</div>

Thanks for your answer.

I use the mouse in both projects, mine and the third person project.

I have double checked what I did with the third person project, and everything is the same. But, probably, I’ve missed something.

**About the input actions** :

This is my Input Action to Look:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/f/2/8f29325813054b635129655275b5721783d0c077.png)

And my IMC\_Default:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/f/7/ef74f5562eab2d45d3765996716e7720c2544426.png)

The blueprint class, that inherits from the C++ class, has everything set for the inputs:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/0/4/604388f1e625ec9f68ac42ea00ddef7c1fb13a6a.png)

The input actions in the C++ of the Character class:

```auto

UCLASS()
class ACTIONROUGELIKE_API ASCharacter : public ACharacter
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess="true"))
	class UInputMappingContext* DefaultMappingContext;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
	class UInputAction* MoveAction;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
	class UInputAction* LookAction;

```

The camera doesn’t orbit around the character and the character doesn’t rotate.

Thanks.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [August 1, 2023, 9:54am UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/4 "2023-08-01T09:54:47Z")

</div>

If I set this to the camera in the character’s blueprint class:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/d/51df8b84abc0e58fe667febf9a7f208a30b08cf0.png)

The camera rotates up and down, and left to right. And also, the character moves its head (I’m using Gideon’s mesh and its animation).

So, I think, the problem is with the `USpringArmComponent`.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [August 2, 2023, 8:26am UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/5 "2023-08-02T08:26:53Z")

</div>

The solution for this problem is:

- Create a new Blueprint class that inherits from the C++ Character class.

- Set the Input mapping context and input mapping actions.

- Set the mesh and animation.

- Used it into the level.

And now it works!

I would like to know why it doesn’t work with the first blueprint class. Is there a way to compare two blueprint classes to see what the differences are?

Thanks.

---

<div class="post-metadata">

**Author:** ![gardian206](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gardian206](https://forums.unrealengine.com/u/gardian206)\
**Post date:** [August 2, 2023, 8:48am UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/6 "2023-08-02T08:48:03Z")

</div>

there is a built in tool for blueprints

> **[Unreal Diff Tool](https://docs.unrealengine.com/5.2/en-US/ue-diff-tool-in-unreal-engine/)**
>
> An overview of using the UE Diff tool in Unreal Engine

the functionality of the tool is Engine version dependent, and might not be great when looking at similar but different things.

for the C++ those are just text files, so anything like WinMerge can diff those.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [August 2, 2023, 8:48am UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/7 "2023-08-02T08:48:10Z")

</div>

I have used the diff tool to know the differences between both, and there is only one:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/9/f/89f2c258626d4917f41dee94f8a40369d21e1879.png)

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 3, 2023, 7:57pm UTC](https://forums.unrealengine.com/t/uspringarmcomponent-doesnt-move-when-busepawncontrolrotation-set-to-true/1246319/10 "2023-09-03T19:57:15Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
