make the forward velocity go in the direction the camera is facing

The first person template uses the ACharacter class for its Pawn.
The CharacterMovementComponent has a property called User Controller Desired Rotation:

To use this, you will need to turn off Orient Rotation to Movement, and also turn off controller yaw in the Character (Pawn) itself.
image

This may or may not give you the behavior you want. (You might also want to turn up the allowed turn rate from the default.)

If this is not enough, then you have to mash the values directly.
Typically, the way you do this is:

  1. Calculate planar velocity (velocity without Z component)
  2. Calculate normalized planar camera forward vector (e g, ignore up/down)
  3. Scale normalized camera vector by velocity
  4. Compose the new desired velocity by taking Z from the old, and XY from the new.
  5. Set the velocity based on this new velocity vector.

If you do this, you can turn on Orient Rotation to Movement, to make sure the character faces the way it’s going.
You’ll have to do something like this every tick:

It may end up being janky, especially on a network, though.

1 Like