Make the default pawn follow a spline using 'CharacterMovement' component

Hey everybody,

I have created a 3rd person game in which I can move the character and rotate around it like any other standard 3rd person game, thanks to the ‘CharacterMovement’ component within ‘Character’ class.

In some points in my game, this default pawn needs to move along a path, without the player being to be able to interfere with it. e.g. the player uses WASD keys to navigate the character to a ‘BoxTrigger’, then the player looses control, and the character starts to follow a path(say a spline).

I have searched the web and I came cross videos for moving objects along a spline, but the problem is, in all of them, they use event tick and update the location and the rotation of the object.

My question is that since the ‘Character’ class provides a powerful ‘CharacterMovement’ component, is it possible to use a function like ‘AddMovementInput’ to move the character along the spline?

Thank you very much

I suppose it is possible, might take more finagling but I’m sure you can. Either way even with “AddMovementInput” you still need to call it every tick to actually get the character to move. So you aren’t getting around “tick” per se, you can use alternative means like a timeline or timer but you still need to update the player position nearly every frame for it to “move”.

Yep.

But first you have to be able to take the points and tangents along the line. I’ve not worked with splines much but if you don’t have a function which returns exactly what you need you will have to do it yourself which might include a bit of math.

Alternatively you can use Matinee to create a real cinematic cut scene and then return the control to the player at the end of it. I have not used that either but here is some documentation.

Also, here is a quick start tutorial.

I’ve used Spline movement on a TP Character successfully using SetActorLocation and doing traces to prevent him from going through walls without full-stop that happens with Sweep.

But he jitters when moving against walls. Maybe overriding AddInputMovement would solve this, and I wouldn’t have to trace?