Camera/Player follows spline in 1st Person

Hi everyone,

Im trying to use UE4 and the Rift to create architectural visualizations (im new to UE4). I would like to make the character strictly follow a spline (always looking forward along the line, which could have turns) but let the player choose with W or S how far on the spline they want to be, i dont know if im explaining myself well. Its basically like a matinee but with the player controlling when they move “forward along the spline I created”. I think that this method will lower the motion sickness of a person when they know they are free to look around but are limited to move in “one” direction (kinda like a nice and soft roller coaster).

I’ve seen this done in side scrolling games but I was wondering how to do that in a 1st person scenario using the Oculus rift.
Does anyone know how to do this? Any help and videos are welcomed!

Thanks in advanced for the help.


Here’s a pretty simple way, create a pawn blueprint with Spectator pawn as the parent class.
Then do this in the pawn blueprint:

Make the spline variable editable in your pawn. You will also need to make a spline blueprint. Then place the pawn and a spline in the level, if you click on the pawn you’ll be able to set the value of the spline variable to be the one you’ve placed in the map.

thanks for the help Mosel3y! some questions though (new to UE4)…

I did the Spectator Pawn and I managed to add a Spline blueprint (SplineMeshActor BP)… how do I draw the spline?

If you place it in the level and select it, you can right click on the spline, and click “Add Spline Point Here”.

(Also, it shouldn’t be a spline mesh if that’s what you’ve done, it should be the other spline component in the list, just called spline)

With the spline selected, you can click any point on it and move, rotate, and scale that point.

In the pick the parent class list there is only the SplineMeshActor BP… 4.7UE4

Saw online that a spline is created on the terrain tool, but how can I name that spline to be referenced in the SpectatorPawn?

So far I have only manages to create a Blueprint:SpectatorPawn and a regular Blueprint:Actor (which I managed to make a spline inside of it as a component). The picture you sent me is inside the BP for the SpectatorPawn but how do I name the Spline from the actor and bring it there?

For some reason, the spectator blueprint refuses to be dragged into the world.

thanks in advanced

Yep, that’s what I meant, an actor blueprint with a spline component, sorry, that wasn’t clear.
To add a reference to the spline in the pawn, you’ll need to have the spline blueprint first. So say you called it BP_MySpline, then in your pawn, create a variable and in the variable type, type in BP_MySpline and it should come up.
If you make that variable editable, when both are placed in the map and you click the pawn, you’ll see in the spline variable in the defaults, you can select the spline you’ve placed in the scene.

This is in the world outliner:

Your attachments won’t open for me, but if you have the pawn selected in the content browser and right click in the scene, can you place it?

I think I was able to add the MySpline_BP into the SpectatorPawn. I also made it editable, but for some reason I cant drag the SpectatorPawn into the world and some of the commands you posted in your first picture, i cant find.

I dont know why you cant see the pictures :confused: they seemed fine when I first uploaded them…


I also cant join the MySpline output into the “Targe” input (Spline Component Reference is not compatible with Spectator Pawn Reference)

Not sure if the “Get Distance Along Spline at Spline Point” is the one you have there. The box with the PLUS sign, i dont know it’s name and the final set distance along spline either :confused:

I really appreciate your help ^^

The spline shouldn’t be a part of the pawn, it should be a separate blueprint actor with just a spline component in it.

The DistanceAlongSpline variable I used is just a float I’ve added, you can call it anything you like. So just add a float variable, with a default value of 0. If you drag that into the graph, you’ll have the option to set and get it, which is all I am doing there.

The Plus node is just a node for addition of two floats, if you type “+” in the menu you will see “float+float”

If you drag off from MySpline there and type in Get World Location, does it come up?

Edit: Also, I just tried and I can’t drag the pawn into the scene either, but if you have it selected and right click in the map you can add it that way

I managed to put the Spectator as you said into the world! :smiley:
Now im only missing the spline in the spectator_BP… My spline is a BP by itself that I dragged into the world… am I doing something wrong?


If you select your SpectatorPawn in the scene, under defaults, you can select the spline. Like in the picture I added above

Ok, I redid the SpectatorBP and now I can see the Spline and set it as a default. Now when I press play (after I selected the Spectator as the default Pawn Class in the Project management) It jumps to the middle of the Spline and I cant move and i get 400 errors afterwards.

Can you post a picture of how your spectator blueprint looks?

Rather than setting it as the default, look in the details of the one you placed in the scene for “Auto possess player” and set it to player 0.

I just moved everything to the Contruct Script Tab and now the error went away but the Input Key W for forward wont show up there… I moved everything back.

Try what I said with the auto possess, I think it probably spawned a new pawn which didn’t have the spline variable set in it.

Ok, set the default to none and then in the Spectator to Player 0, I still seem to spawn in the point 0,0,0 and i get the 400 errors “Access none ‘The Spline’ from construction…” but if I move everything to the construction tab, then i cant have the “InputAxis Forward” :confused:

It definitely should not be in the construction script.
In your spline blueprint, is NewVar 0 what the spline component is called? It should only have one component, just that spline

wait, i think its working! I forgot to set the spline back again inside the Spectator in the default tab, since I redid it…! let me check if its working as intended now