# CharacterMovementComponent ignores gravity direction

**URL:** <https://forums.unrealengine.com/t/charactermovementcomponent-ignores-gravity-direction/1774687>\
**Category:** C++\
**Tags:** gravity, unreal-engine, CPP, question\
**Created:** [March 27, 2024, 2:53pm UTC](https://forums.unrealengine.com/t/charactermovementcomponent-ignores-gravity-direction/1774687 "2024-03-27T14:53:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![voyant\_3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@voyant\_3](https://forums.unrealengine.com/u/voyant_3)\
**Post date:** [March 27, 2024, 2:53pm UTC](https://forums.unrealengine.com/t/charactermovementcomponent-ignores-gravity-direction/1774687/1 "2024-03-27T14:53:22Z")

</div>

In [this post](https://forums.unrealengine.com/t/5-3-default-character-movement-controller-gravity-direction-greyed-out/1356641), the accepted answer shows screenshots of editing the gravity vector and having a character rotate accordingly. When I do this:

```auto
UE_LOG(LogTemp, Warning, TEXT("Gravity before is %s"), *CharacterMovement->GetGravityDirection().ToString());
CharacterMovement->SetGravityDirection(GravityDirection);
UE_LOG(LogTemp, Warning, TEXT("Gravity after is %s"), *CharacterMovement->GetGravityDirection().ToString());

```

I see from the logs that the gravity direction is changing; however, the character does not rotate accordingly, nor is it drawn towards the source of my gravity. It seems like this value is completely ignored.

I can, of course, apply gravity myself:

```auto
CharacterMovement->AddForce(GravityDirection * GravityStrength * SphereMesh->GetMass() * CharacterMovement->Mass /SqrDistance);

```

But this does not rotate the character accordingly. Why is the SetGravityDirection function there if the value will just be ignored? Furthermore, any advice on how to achieve this effect?
