Announcement

Collapse
No announcement yet.

Teleporting the VR-player by Keyboard input

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

    Teleporting the VR-player by Keyboard input

    hi there

    So I'm relatively new to the Unreal editor, which is why I couldn't find a specific answer for my question, but instead like a million with various outcomes and variables. So maybe you guys can help me, I think my problem is very trivial in nature.
    I recently introduced VR to my boss, he's fascinated by it and wants to show it to the customers. I set up a world, placed a working VR pawn, did the appropriate NavMesh-work etc, it works like a charm.

    What I need to do now is I have 4 different locations on this map that I need to show the customers. These positions are not reachable by the default teleporting mechanism that you do with the motion controller. Since I will be monitoring the customer during the VR experience, I want to be able to teleport him to the 3 other locations by pressing buttons on the keyboard. Simple, 1 for position 1, 2 for position 2, etc.

    -Would you recomment copying the VR-Pawn four times and do it by possessing/unpossessing and would you kindly show me how to set up the blueprint?

    -Or would you simply take the one Pawn and teleport it to the 3 other locations by button press? I would like that more, to be honest.
    Is it possible to define three points on my world and tell the pawn to move to them by button press? Say I press Enter, it moves to the next point. Like a quick transition, not an instant blink.

    Actually I'd love to create something like the spheres in Valve's VR-Lab, which you have to pick up and put into your face to be teleported to another location/level, but my time is limited, also I don't need to teleport to another level.

    Can you help me?
    Last edited by av_vrlab; 12-15-2019, 10:34 AM.

    #2
    It's pretty easy actually.
    • Create a blueprint actor which represents the target location for the move. Let's call it BP_Target. Place as many as you need around your level.
    • Next, from the level Blueprint, on Begin Play, do a Get All Actors of Class BP_Target and fill in an array with them. Save to a variable. Let's call it Target_Array.
    • Define an integer which represents the current target. Let's call it current_target. Initially it is 0.
    • In your Level BP, track the Enter input key event. When Enter is pressed, increase the current_target integer. If its above the total number of BP_Targets you placed in the level, roll it back to 0.
    • Then do a Get(current_target) from the Target_Array. The result is the next BP_Target to move to. Get its World Location and store it as Destination_Location.
    • Now do a Set Actor World Location for your pawn setting Destination_Location as your target location.
    As a further level of sophistication you can also define a direction, so when teleported your player will look in a given direction. The principle is the same but you need to work with Rotations instead of Locations.

    Good luck with your project!
    CTO | Head of VR Development - Visit us at http://humanxr.com
    My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

    Comment


      #3
      Wow, thank you for the answer. Just by reading, I have a lot of questions. I'll have to do it step by step and see if it works out. Might create a little testing level for this.
      If I have further questions, I will come back at you. Thanks again!

      Comment


        #4
        Originally posted by vr_marco View Post
        do a Get All Actors of Class BP_Target and fill in an array with them.
        So far so good, but there seem to be different types of arrays. Which kind do I choose?

        Would you mind showing me a screenshot of what the nodes should look like?

        *edit*

        Hold on for just a second. There is an actual teleport function that does exactly what I need. It's very simple and self explanatory to set up.
        https://www.youtube.com/watch?v=bTLK62dgPPA
        Your solution seems way more complicated, but what is the difference?

        Last edited by av_vrlab; 12-16-2019, 06:55 AM.

        Comment


          #5
          Originally posted by av_vrlab View Post

          So far so good, but there seem to be different types of arrays. Which kind do I choose?

          Would you mind showing me a screenshot of what the nodes should look like?

          *edit*

          Hold on for just a second. There is an actual teleport function that does exactly what I need. It's very simple and self explanatory to set up.
          https://www.youtube.com/watch?v=bTLK62dgPPA
          Your solution seems way more complicated, but what is the difference?
          Get All Actors of Class returns an array. You have to turn that array into a variable (right click Promote to Variable) and the type will be automatically assigned. It will be the same type of the class you are using in the Get All Actors of Class function.

          What I suggested you is a generalization of what you see in that tutorial. Instead of having one single teleportation destination, you have multiple ones in a sequence. This is what you asked for.
          Last edited by vr_marco; 12-16-2019, 10:04 AM.
          CTO | Head of VR Development - Visit us at http://humanxr.com
          My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

          Comment

          Working...
          X