# Character movement via SetActorLocation

**URL:** <https://forums.unrealengine.com/t/character-movement-via-setactorlocation/399302>\
**Category:** Character & Animation\
**Tags:** Replication, setactorlocation, unreal-engine, UE4, question, Blueprint\
**Created:** [June 26, 2017, 4:42pm UTC](https://forums.unrealengine.com/t/character-movement-via-setactorlocation/399302 "2017-06-26T16:42:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![4e6yp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@4e6yp](https://forums.unrealengine.com/u/4e6yp)\
**Post date:** [June 26, 2017, 4:42pm UTC](https://forums.unrealengine.com/t/character-movement-via-setactorlocation/399302/1 "2017-06-26T16:42:14Z")

</div>

Hello. I’ve been trying to create replicated top-down character (like air hockey striker), controlled by mouse. It must follow mouse movement precisely to be comfortable for player. I couldn’t find a way to use **AddMovementInput** , because it wasn’t feeling responsive. I’ve tried to tweak all of the CharacterMovement variables (acceleration/braking friction/ground friction and others), but unsuccessfully.

So I’ve implemented movement with **SetActorLocation** function after getting Forward and Right InputAxis. I call it on client and then on server (pic. 1). It feels just right to control, but I’ve ran into some problems with that.

First of all – **I can’t move along the obstacle on my way**. I use SetActorLocation with sweep, so when I hit any obstacle – character just stops. I’ve found a solution (pic. 2) to move along the wall with normal vector, where either X or Y == 0. For example, if hit normal vector == (0, 1, 0), then I move along X axis. Z axis doesn’t matter; character is constrained to XY-Plane. But if normal vector == (0.4, 0.6, 0), then I can’t figure out how to move along the obstacle surface. So the question is - how to move along obstacle with SetActorLocation type of movement. I’ve tried to calculate surface equation, it kind of worked, but since it’s being called each tick – it was very laggy.

Second problem is **how to handle ping** situation with that kind of movement. If character hits some object on server while on client it didn’t hit anything – character on client teleports to hit point for one tick and then comes back to previous location. I tried to set flag “Ignore Client Movement Error check”, but it doesn’t work as I thought it would. Is there any other way to ignore Server-Client location correction?

Thank you for any help!

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/7/0e7d7527b4630b8dee16909eb3dd280fd89223bf.png) ](https://i.imgur.com/vVDBA3A.png)

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/5/e45505da42e238b5423e1e675018954b7318b24f.png) ](https://i.imgur.com/D2YpGLZ.png)
