Download

Correct usage of UCharacterMovementComponent for flying game

I am making a flying game, top down arcade shooter and I want it to work multiplayer.

Initially I had setup a pawn class with my own actor states which control movement using SetActorRelativeLocation and SetActorRotation but this did not work multiplayer.
I am now trying to change my base class to a character and have applied a default UCharacterMovementComponent but there is not anything like SetActorRelativeLocation or SetActorRotation
such that I can move and rotate my actor.

How do I achieve this?

I don’t think charactermovement allows for rotation does it? Either way, I’d expect you’d have more luck using your old method. What didn’t work on the network? did you set the actor to replicated?

Someone in another thread on this forum is talking about floatingpawnmovementcomponent, which sounds more like what you want. Maybe investigate that?

You can still call SetActorLocation/Rotation on the actor, but these methods will ignore the movement component.
To have it be used, you should call AddMovementInput instead.

Still, as zoombapup said, UCharacterMovementComponent may not be the best thing to use for a flying game, it’s designed for characters with a capsule collision component walking on a surface.