Announcement

Collapse
No announcement yet.

Camera/Player follows spline in 1st Person

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Regards,
    Seichi

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

    Click image for larger version

Name:	Pu7PWaT.png
Views:	1
Size:	142.3 KB
ID:	1080352

    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.

    Comment


      #3
      Hi,
      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?

      Comment


        #4
        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.

        Comment


          #5
          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?

          Comment


            #6
            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?
            Last edited by Seichi; 06-23-2015, 12:50 PM.

            Comment


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



              thanks in advanced

              Comment


                #8
                Originally posted by Seichi View Post
                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?
                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:
                Click image for larger version

Name:	aQPmg46.png
Views:	1
Size:	41.0 KB
ID:	1080416

                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?

                Comment


                  #9
                  Hi,
                  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 :/ they seemed fine when I first uploaded them...

                  Click image for larger version

Name:	Spline.JPG
Views:	1
Size:	248.0 KB
ID:	1080418

                  Comment


                    #10
                    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 :/

                    I really appreciate your help ^^

                    Comment


                      #11
                      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
                      Last edited by Mosel3y; 06-24-2015, 06:09 AM.

                      Comment


                        #12
                        I managed to put the Spectator as you said into the world!
                        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?

                        Click image for larger version

Name:	Spline3.JPG
Views:	1
Size:	291.4 KB
ID:	1080419

                        Comment


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

                          Comment


                            #14
                            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.

                            Click image for larger version

Name:	Spline4.JPG
Views:	1
Size:	81.9 KB
ID:	1080422

                            Comment


                              #15
                              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.

                              Comment

                              Working...
                              X