# Sidescroller character not turning

**URL:** <https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130>\
**Category:** Character & Animation\
**Tags:** sidescroller, side-scroller, unreal-engine, template, question, CPP\
**Created:** [January 12, 2021, 10:39am UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130 "2021-01-12T10:39:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_d3dfecd91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d3dfecd91](https://forums.unrealengine.com/u/anonymous_user_d3dfecd91)\
**Post date:** [January 12, 2021, 10:39am UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/1 "2021-01-12T10:39:12Z")

</div>

![327015-movinghorizontallyforward.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/1/87166ff904d49294bcf2dddfdcf11d8a0ab96c4b.jpeg)

I am trying to understand setting up a side scroller character from scratch by referring to the one prebuilt in unreal. I copied the base setting in the .cpp and .h file exactly. The forward movement is normal but while turning back the character only turns like 15 degrees away from the camera. How is it that the same code that works for the template does not work for my project?

The moving back picture is the MovingHorizontallyback attached below

---

<div class="post-metadata">

**Author:** ![Kehel18](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kehel18](https://forums.unrealengine.com/u/Kehel18)\
**Post date:** [January 12, 2021, 4:30pm UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/2 "2021-01-12T16:30:54Z")

</div>

Hi there! Do you check this options?

 ![327032-ue-rot.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/6/c/06c06b44c2be3824d34991e196fe495ed18e323f.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d3dfecd91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d3dfecd91](https://forums.unrealengine.com/u/anonymous_user_d3dfecd91)\
**Post date:** [January 13, 2021, 1:33am UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/3 "2021-01-13T01:33:32Z")

</div>

Yes. It was already set in the .cpp file

---

<div class="post-metadata">

**Author:** ![Kehel18](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kehel18](https://forums.unrealengine.com/u/Kehel18)\
**Post date:** [January 13, 2021, 3:16pm UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/4 "2021-01-13T15:16:55Z")

</div>

Can you share h and cpp files?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d3dfecd91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d3dfecd91](https://forums.unrealengine.com/u/anonymous_user_d3dfecd91)\
**Post date:** [January 14, 2021, 2:18am UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/5 "2021-01-14T02:18:12Z")

</div>

This is the .cpp part 2

// Called when the game starts or when spawned  
void ACharacterSideScroller::BeginPlay()  
{  
Super::BeginPlay();

```
    }
    
    // Called every frame
    void ACharacterSideScroller::Tick(float DeltaTime)
    {
    	Super::Tick(DeltaTime);
    
    }
    
    // Called to bind functionality to input
    void ACharacterSideScroller::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
    {
    	Super::SetupPlayerInputComponent(PlayerInputComponent);
    
    	//Binding input
    	PlayerInputComponent->BindAxis("AxisDA", this, &ACharacterSideScroller::MoveHorizontal);
    
    
    }
    
    void ACharacterSideScroller::MoveHorizontal(float Value)
    {
    	AddMovementInput(FVector(1.f, 0.f, 0.f), Value);
    
    }

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d3dfecd91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d3dfecd91](https://forums.unrealengine.com/u/anonymous_user_d3dfecd91)\
**Post date:** [January 14, 2021, 2:20am UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/6 "2021-01-14T02:20:52Z")

</div>

This is .cpp file pt 1

```
 // Fill out your copyright notice in the Description page of Project Settings.

#include "CharacterSideScroller.h"

// Sets default values
ACharacterSideScroller::ACharacterSideScroller()
{
 	// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	// Makes the Camera rotate the character rather than the controller
	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = false;
	bUseControllerRotationRoll = false;

	//Creating components
	CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("Camera Boom"));
	CameraBoom->SetupAttachment(RootComponent);
	CameraBoom->SetUsingAbsoluteRotation(true);
	CameraBoom->TargetArmLength = 500.0f;

	Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
	Camera->SetupAttachment(CameraBoom);
	Camera->bUsePawnControlRotation = false;

	GetCharacterMovement()->bOrientRotationToMovement = true; 
	GetCharacterMovement()->RotationRate = FRotator(0.0f, 720.0f, 0.0f); 
	GetCharacterMovement()->GravityScale = 2.f;
	GetCharacterMovement()->AirControl = 0.20f;
	GetCharacterMovement()->JumpZVelocity = 1000.f;
	GetCharacterMovement()->GroundFriction = 3.f;
	GetCharacterMovement()->MaxWalkSpeed = 600.f;
	GetCharacterMovement()->MaxFlySpeed = 600.f;
}

```

---

<div class="post-metadata">

**Author:** ![Kehel18](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kehel18](https://forums.unrealengine.com/u/Kehel18)\
**Post date:** [January 14, 2021, 4:33pm UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/7 "2021-01-14T16:33:42Z")

</div>

Check your code on 4.23 - everything is working, character is turning! (code that is posted + almost empty BP where I set only mesh and anim)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d3dfecd91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d3dfecd91](https://forums.unrealengine.com/u/anonymous_user_d3dfecd91)\
**Post date:** [January 15, 2021, 7:09am UTC](https://forums.unrealengine.com/t/sidescroller-character-not-turning/477130/8 "2021-01-15T07:09:23Z")

</div>

But why would the template work?  
Thanks anyway.
