# How to set character SideWays velocity?

**URL:** <https://forums.unrealengine.com/t/how-to-set-character-sideways-velocity/839531>\
**Category:** C++\
**Tags:** issues, ue4-editor, ue, unreal-engine, CPP, question\
**Created:** [April 2, 2023, 10:52pm UTC](https://forums.unrealengine.com/t/how-to-set-character-sideways-velocity/839531 "2023-04-02T22:52:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [April 2, 2023, 10:52pm UTC](https://forums.unrealengine.com/t/how-to-set-character-sideways-velocity/839531/1 "2023-04-02T22:52:29Z")

</div>

I am trying to wrap this function in one line.

```auto
	FVector TempVelocity = TryGetPawnOwnerRef->GetVelocity();
	FRotator TempRotation = TryGetPawnOwnerRef->GetActorRotation();
	FVector BreakUnRotator = TempRotation.UnrotateVector(TempVelocity);
	SidewaysVelocity = BreakUnRotator.Y;

```

tried tihs but not compiling:  
BreakUnRotator = FRotator::UnrotateVector(FVector(TryGetPawnOwnerRef-\>GetVelocity(), FRotator(TryGetPawnOwnerRef-\>GetActorRotation())));

```auto

```

---

<div class="post-metadata">

**Author:** ![mnelenpridumivat](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mnelenpridumivat/32/1194643_2.png) [@mnelenpridumivat](https://forums.unrealengine.com/u/mnelenpridumivat)\
**Post date:** [April 2, 2023, 11:20pm UTC](https://forums.unrealengine.com/t/how-to-set-character-sideways-velocity/839531/2 "2023-04-02T23:20:04Z")

</div>

I guess the problem is with FRotator::UnrotateVector - this is not a static method, which means you need to call it only from a specific object.  
I think the correct wrapping is:

```auto
FVector BreakUnRotator = TryGetPawnOwnerRef->GetActorRotation().UnrotateVector(TryGetPawnOwnerRef->GetVelocity());

```

(I’ll think lack of compiler’s error log is just a forum bug)
