Announcement

Collapse
No announcement yet.

VR Mutiplayer Actor Possession

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

    [VIVE] VR Mutiplayer Actor Possession

    Hello All,

    I am trying to get my local multiplayer server to work properly in VR. I am running this as a listen server (not sure how to run dedicated servers). When Player 1 enters the lobby, he types 'open MenuLevel?listen' to start the listen server. Once Player 1 opens the listen server, the following code is executed within the Level Blueprint.

    Click image for larger version  Name:	Untitled.png Views:	1 Size:	217.3 KB ID:	1444959
    The code allows Player 1 to possess "VRPawn_1" which is placed in the level by default, but when Player 2 joins the server, it does not possess "VRPawn_2" which is also placed in the level by default. Is there a way to force Player 2 to automatically possess VRPawn_2 when they join the server?

    #2
    There is OnPostLogin event in a game mode blueprint. You can use it to assign new pawn to a new player.
    Marketplace: Vive Mocap Kit / Fingers Solver / VR IK Body Solver / Subtitles to LipSync / Dialogue System with Character Animation
    And random stuff at Youtube

    Comment


      #3
      Originally posted by YuriNK View Post
      There is OnPostLogin event in a game mode blueprint. You can use it to assign new pawn to a new player.
      With that event, would I put all of my previous blueprint after that? Also, does this possess the actors already placed in the level, or does it just spawn new actors?

      Comment


        #4
        Originally posted by ZeroBytes View Post
        With that event, would I put all of my previous blueprint after that?
        No. This event has a reference to the newly connected player controller. In BeginPlay you can save an array of free pawns (GetAllActorsOfClass), and then in OnPostLogin possess a next free pawn actor from this array. Another way is to place PlayerStart actors at Level instead of pawns and spawn pawn in OnPostLogin at next free location. And, finally, you can select default pawn class in Game Mode properties to allow Game Mode to spawn it automatically for all new players. In this case, use OnPostLogin just to set the desired position for newly connected players.

        https://docs.unrealengine.com/en-US/...ode/Blueprints
        Marketplace: Vive Mocap Kit / Fingers Solver / VR IK Body Solver / Subtitles to LipSync / Dialogue System with Character Animation
        And random stuff at Youtube

        Comment


          #5
          Originally posted by YuriNK View Post
          No. This event has a reference to the newly connected player controller. In BeginPlay you can save an array of free pawns (GetAllActorsOfClass), and then in OnPostLogin possess a next free pawn actor from this array. Another way is to place PlayerStart actors at Level instead of pawns and spawn pawn in OnPostLogin at next free location. And, finally, you can select default pawn class in Game Mode properties to allow Game Mode to spawn it automatically for all new players. In this case, use OnPostLogin just to set the desired position for newly connected players.

          https://docs.unrealengine.com/en-US/...ode/Blueprints
          Thanks, I am using the below code to try and get it to automatically possess Pawn1 and Pawn2 that are placed in the level by default. VRPawn_1 automatically possesses players with ID 0, and VRPawn_2 automatically possesses players with ID 1.

          Click image for larger version  Name:	Untitled1.png Views:	1 Size:	74.0 KB ID:	1446487

          When Player 2 spawns now, it can see its hands, which it couldn't before, but will not spawn in the correct place. I have 2 Player Start locations in the level, with PlayerStart auto possessing and detecting input from Player0, and PlayerStart2 auto possessing and detecting input from Player1. Does this configuration work properly? PlayerStarts have "Always Spawn, Ignore Collissions" set on Spawn Collision Handling.

          Also when checking the log, it looks like it creates Player 2 automatically, without a second player joining, would this be a problem as well?


          EDIT:
          I created this rough draft here to try and show what I am attempting to accomplish. The only reason I need to possess the two separate actors in the level is because I have to move both actors simultaneously, and have visible replication (replication is implemented within the actors). VRPawn_1 in the level automatically possesses a player with ID 0, and VRPawn_2 automatically possesses a player with ID 1. The problem with this current configuration is that the player possesses both pawns at the same time. Not sure what to do here.
          Click image for larger version

Name:	Untitled2.png
Views:	16
Size:	131.8 KB
ID:	1446605
          Last edited by ZeroBytes; 03-19-2018, 08:02 PM.

          Comment


            #6
            I was able to create this blueprint, which has helped me, but not fully.

            Click image for larger version

Name:	LevelBlueprint.png
Views:	16
Size:	168.7 KB
ID:	1448441
            This is in the level blueprint, and it is successfully letting the server possess the VRPawn_1, but the client is not possessing VRPawn_2, even though the console log is saying it is. I know the "Possess" feature is server-side only, so how can I get the client to automatically possess VRPawn_2. I have tried playing around with the OnPostLogin event, but there is no way to get it to possess an actor already placed in the level, only spawn a new one, which will not work for what I am attempting to do with my project. Any help would be greatly appreciated!

            Comment


              #7
              Still looking for some assistance with this, if anyone can help out, would be much appreciated! Also posted this on the Answerhub, with no answers yet.

              Comment

              Working...
              X