Announcement

Collapse
No announcement yet.

Creating a simple punching bag prototype?

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

  • [VIVE] Creating a simple punching bag prototype?

    Hello,

    For a project, my classmate and I are trying to create a simple boxing prototype using the HTC Vive. We have successfully set up a project to take the VR headset, and attach boxing glove static meshes to the controllers in virtual space. However, we are having trouble getting any object to respond to any contact between either of the hands. As it stands, the gloves just phase through anything presented to it, even with efforts made to apply collision and boundaries to objects. We're not looking for anything super complex, just a cube or cylinder that pushes away based on how fast the collision is made, and ideally relies on a 'hinge' or central point somewhere above it to vaguely resemble a punching bag. Is there a tutorial or resource that we can study that would show us how to create these collisions and physics within the project?

    If desired, when I get home, I can upload the project files and content somewhere for examination if necessary.

    If time permits we may add a 'score' system to show a numerical value for the hardest punch made in the current session, but that's a whole other topic.

  • #2
    For the hinge I can only think of physics constraint component (added to the actor blueprint and set up properly), as for the collisions, well an obvious guess would be to double check collisions on the hand mesh as well as mesh you are willing to interact with (perhaps setting both of these to block all would solve this issue for the time being). Upload a project somewhere so I might be able to look it up tomorrow/Friday.
    VR/AR Development
    Hook me up Discord - Shin#0402

    Comment


    • #3
      https://drive.google.com/drive/folde...GM?usp=sharing That should work, let me know if it doesn't. Not really sure how to upload UE4 projects anywhere, Dropbox kept chucking up errors.

      Comment


      • #4
        Hrm, we're still struggling to get even a box or another object to just be pushed away from the glove. Any additional suggested tutorials or information would be more than helpful. I'll upload footage/screenshots when I can.

        Comment


        • #5
          Originally posted by bart95 View Post
          Hrm, we're still struggling to get even a box or another object to just be pushed away from the glove. Any additional suggested tutorials or information would be more than helpful. I'll upload footage/screenshots when I can.
          So I've downloaded your project and added simple punching bag (cube) actor. The main reason why your objects didn't want to interact with the glove was simply due to "Simulate Physics" not checked on the object. Obviously you can set an object to simulate physics at any given time, however it needs to be set in order for the objects to be grabable/pushable etc. Punching bag (cube) is done with physics constraints. In order to get more realistic behavior you'd need to mess with constraint settings a bit. Have fun !

          Punching Bag project download
          VR/AR Development
          Hook me up Discord - Shin#0402

          Comment


          • #6
            Originally posted by Shin_ji View Post
            So I've downloaded your project and added simple punching bag (cube) actor. The main reason why your objects didn't want to interact with the glove was simply due to "Simulate Physics" not checked on the object. Obviously you can set an object to simulate physics at any given time, however it needs to be set in order for the objects to be grabable/pushable etc. Punching bag (cube) is done with physics constraints. In order to get more realistic behavior you'd need to mess with constraint settings a bit. Have fun !

            Punching Bag project download
            Thanks! Although now for so.e reason the glove meshes or controllers are not moving at all. We can actually see two pairs of the static mesh in the world when running the game, but not in the pawn nor in the editor. Very odd.

            Comment


            • #7
              Originally posted by bart95 View Post
              Thanks! Although now for so.e reason the glove meshes or controllers are not moving at all. We can actually see two pairs of the static mesh in the world when running the game, but not in the pawn nor in the editor. Very odd.
              Move the player start up a bit.
              VR/AR Development
              Hook me up Discord - Shin#0402

              Comment


              • #8
                Originally posted by Shin_ji View Post
                Move the player start up a bit.
                Aha, that did it. Some tweaking of the camera and pawn positioning later and we got it working, thanks again! Now to study the implementation of haptic feedback on collision!

                Comment


                • #9
                  Create a function similiar to the one in VR Template, called Rumble Controller, in your Punching Bag bp call EventHit with a cast to your Pawn and call Rumble Controller function from the Pawn. It's not described precisely but should get you pointed in the right direction.
                  VR/AR Development
                  Hook me up Discord - Shin#0402

                  Comment


                  • #10
                    Originally posted by Shin_ji View Post
                    Create a function similiar to the one in VR Template, called Rumble Controller, in your Punching Bag bp call EventHit with a cast to your Pawn and call Rumble Controller function from the Pawn. It's not described precisely but should get you pointed in the right direction.
                    Thanks, we got rumble working. Sort of. Regardless of which glove hits the box, only one specific controller or both controllers vibrate, we're dissecting the template to try and figure out how it has managed to differentiate it and make the rumble occur on a different controller based on which mesh is making the collision. I suspect it is related to the fact that we have two meshes in the vr pawn but in the template they only have the one that is then mirrored and attached to the other hand. I know we need to define somehow which mesh is colliding to then trigger one of two rumble events.

                    The template does have an OnComponentHit event but we can't figure out how to point it to either of our glove meshes or motioncontroller nodes in the vr pawn.

                    Comment


                    • #11
                      Originally posted by bart95 View Post
                      Thanks, we got rumble working. Sort of. Regardless of which glove hits the box, only one specific controller or both controllers vibrate, we're dissecting the template to try and figure out how it has managed to differentiate it and make the rumble occur on a different controller based on which mesh is making the collision. I suspect it is related to the fact that we have two meshes in the vr pawn but in the template they only have the one that is then mirrored and attached to the other hand. I know we need to define somehow which mesh is colliding to then trigger one of two rumble events.

                      The template does have an OnComponentHit event but we can't figure out how to point it to either of our glove meshes or motioncontroller nodes in the vr pawn.
                      Well the template basically mirrors the other hand. They used just one hand model, while other hand is spawned with -1 scale on the z axis, they detected the hands based on the enum iirc.
                      VR/AR Development
                      Hook me up Discord - Shin#0402

                      Comment

                      Working...
                      X