Announcement

Collapse
No announcement yet.

Spawn and attach Actor to client

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

    Spawn and attach Actor to client


    Hello everybody,
    I'm trying to create a VR multiplayer game.
    It is important that every player has a head attached and also two hands as MotionController.
    So far I have tried that as soon as the playable Pawn is selected from the menu the event BeginPlay from the selected Pawn is triggered.
    After that the event SpawnHead (Replication, Run on Server) is called. This event spawns the blueprint of the head at 0,0,0. Then the event AttachHead is called.
    This event is a multicast and uses attach actor to attach the head to the pawn. On the server, this works fine, but not with the client. The server sees itself correctly, however the head of the client still stays in position 0,0,0 (and not attached to the Pawn).
    The client, however, sees the head attached to the server and moving correctly.

    I hope somebody can help me this time. I am starting to despair.
    Incidentally, the same applies to the MotionController. Maybe someone can upload a suitable setup as an example as screenshot.
    would be very grateful.

    #2
    Hey, you will have to multicast from the server to the clients, so the clients also do know what is up.

    Comment


      #3
      Originally posted by Caboose413 View Post
      Hey, you will have to multicast from the server to the clients, so the clients also do know what is up.
      Thanks for the quick reply. But I don't know exactly what you mean. I post some screenshots and maybe you can tell me what i did wrong? It's all inside the MotionController Pawn except for the last which is located in the CharacterSelectWidget...

      Attached Files

      Comment


        #4
        My question is why do you attach thoes components with code, and not simply add them to your character.

        Comment


          #5
          Like Caboose say I found that add anything you need to the character and change the visibility is the best solution, i think is better to use blueprint mode for attach real environment stuff to the character, like pickups.

          Comment


            #6
            If I do so and the client tires to join the match unreal crashes with error: Assertion failed: Component != nullptr [File:\Build\++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\HeadMountedDisplay\Private\LateUpdateManager.cpp] [Line: 75]

            Comment


              #7
              Anyway I will reply to your question, you are spawning an actor on server side and attaching it to clients using a multicast event, the problem is: that actor exist actually only on the server and was never spawned on clients, so you're attaching (nothing) something that from client side doesn't exist.
              Last edited by kalakus; 08-03-2018, 05:32 AM.

              Comment


                #8
                Thank you very much. But I think that your first purpose sounds much better.
                I tried to attach hands and head bp's to my character. But I dont know if this is the right way?
                Attached Files

                Comment


                  #9
                  Originally posted by Sniw View Post
                  Thank you very much. But I think that your first purpose sounds much better.
                  I tried to attach hands and head bp's to my character. But I dont know if this is the right way?
                  I never worked with VR, in a normal environment I will attach it to the character skeletal mesh, but for VR I think is different so try it like you're doing and let us know.

                  Comment


                    #10
                    I think the game crashes cuz of "wrong" attachments in character. When I remove them it runs like before...

                    Comment


                      #11
                      Originally posted by Sniw View Post
                      I think the game crashes cuz of "wrong" attachments in character. When I remove them it runs like before...
                      if the attachments are wrong it crash.

                      Comment


                        #12
                        If somebody ever has worked with attach MotionControllers in VR or similar to that it would be very glad to hear from you

                        Comment


                          #13
                          I added vr support to my project recently and all I did was adding the motion controller component to my character, my project also supports multiplayer but I was not able to test vr + multiplayer since.

                          Comment


                            #14
                            Can you please tell me how you add MotionController to your character?

                            Comment


                              #15
                              What engine version are you using?



                              Click image for larger version  Name:	MotionController.jpg Views:	1 Size:	140.6 KB ID:	1511783

                              Comment

                              Working...
                              X