Announcement

Collapse
No announcement yet.

Footsteps

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

    [VIVE] Footsteps

    Anyone have any idea how you would set up footstep sound in VR. All the tutorials I’ve seen use the walking animation in the player character but in vr you don’t use animation for the main player vr pawn.

    #2
    Which template you use it for VR?

    Comment


      #3
      Originally posted by mandango View Post
      Which template you use it for VR?
      Weapon master vr from the marketplace.

      Comment


        #4
        One way to do it would be to keep track of the distance the pawn has moved and produce a step sound every 50 cm or so. To make it more realistic, you should also consider the speed (higher speed = higher stride distance) and the physics / material of the terrain under the pawn.

        Comment


          #5
          Originally posted by marcog72 View Post
          One way to do it would be to keep track of the distance the pawn has moved and produce a step sound every 50 cm or so. To make it more realistic, you should also consider the speed (higher speed = higher stride distance) and the physics / material of the terrain under the pawn.
          Any idea of how I could keep track of the distance traveled?

          Comment


            #6
            Create two variables, Last Position as Vector and Distance as Float. On Pawn movement (or Event Tick), calculate GetActorLocation - Last Position. The length of this vector is the moved distance. Add it to Distance and check whether Distance > Stride Length. If so, make a foot step sound and subtract Stride Length from Distance, so you are ready for the next step. Of course this only makes sense with Thumbstick locomotion, not with teleportation.
            CTO | Head of VR Development - Visit us at http://humanxr.com
            My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

            Comment


              #7
              I have been busy for the last few weeks so I only saw your reply now. I haven’t tried this yet but I will tonight. Any idea how I could have different sounding footsteps. One for grass one for wood and so on. I know how to set up the materials for different sounds but again that only works when an object physically touches the material not for a vr pawn. Someone said setting up a line trace but how would you get that to work with your bp?

              Comment


                #8
                In an Event Tick, you can use Line Trace By Channel to trace down (negative Z direction) from the center of your Pawn to the underlying terrain. By breaking Hit Results, you will see there is a Phys Mat property. From that one you get Surface Type and then Switch among the different types of physical surfaces to make different sounds. It doesn't matter that the Pawn doesn't have a physical body because you use raycasting to "sample" the underlying material and get its physical surface type.
                CTO | Head of VR Development - Visit us at http://humanxr.com
                My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                Comment


                  #9
                  Perfect thanks I’ll try that when I get home.

                  Comment


                    #10
                    Originally posted by vr_marco View Post
                    Create two variables, Last Position as Vector and Distance as Float. On Pawn movement (or Event Tick), calculate GetActorLocation - Last Position. The length of this vector is the moved distance. Add it to Distance and check whether Distance > Stride Length. If so, make a foot step sound and subtract Stride Length from Distance, so you are ready for the next step. Of course this only makes sense with Thumbstick locomotion, not with teleportation.
                    Hi I am trying to put together this BP but now that I am trying I'm finding there are a few missing pieces or misunderstanding on my part. OK so I have created the two variables. Last position as a Vector and distance as a float.

                    Click image for larger version

Name:	Capture.JPG
Views:	96
Size:	5.7 KB
ID:	1397492

                    Pawn movement would be a bit tricky with the pawn I'm using so I'll go with event tick. Now you say to "calculate the getactorlocation node - last position" but what do you mean by calculate?
                    Click image for larger version

Name:	Capture1.JPG
Views:	93
Size:	12.1 KB
ID:	1397493
                    The Last Position vector doesn't connect to the get actor location node so there must be another node that you didn't mention that allows me to do that. To "Calculate" it. I don't know what node to use so that is where the gap in my knowledge comes in.

                    Now I think I know what you mean by "The length of this vector is the moved distance. Add it to Distance and check whether Distance > Stride Length. If so, make a foot step sound" which are these nodes.

                    Click image for larger version

Name:	Capture2.JPG
Views:	92
Size:	54.9 KB
ID:	1397495

                    But when you mention "and subtract Stride Length from Distance, so you are ready for the next step." again I'm not sure what nodes I would use here and where to plug them in.

                    Lastly I think I have got the Line Trace By Channel for different footstep sounds right but I can't check until I figure out that 1st part and what you want me to do with the getactorlocation node.

                    Click image for larger version

Name:	Capture3.JPG
Views:	93
Size:	79.8 KB
ID:	1397496
                    Attached Files

                    Comment


                      #11
                      I meant calculate the vector difference between GetActorLocation and Last Position (there was a minus sign in between them in my original message but could have easily been missed)

                      The Length of this difference vector is the moved distance
                      CTO | Head of VR Development - Visit us at http://humanxr.com
                      My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                      Comment


                        #12
                        Originally posted by vr_marco View Post
                        I meant calculate the vector difference between GetActorLocation and Last Position (there was a minus sign in between them in my original message but could have easily been missed)

                        The Length of this difference vector is the moved distance
                        Hi I'm sorry I don't think I explained ,myself properly. You only mention 4 nodes. The event tick, a vector which is called Last Position, a float which is called Distance and getactorlocation. I don't know what node to plug the getactorlocation into. How do I connect the GetActorLocation node and Last Position vector. Using vector difference? Which node is this? How do I connect the getactorlocation node to the event tick. There must be other nodes I have to use that you are not mentioning? Here is a picture to better explain what I mean.
                        Click image for larger version

Name:	Capture5.JPG
Views:	93
Size:	53.4 KB
ID:	1397517
                        Click image for larger version  Name:	Capture4.JPG Views:	1 Size:	146.9 KB ID:	1397516
                        Last edited by tcla75; 12-08-2017, 08:10 PM.

                        Comment


                          #13
                          You have to subtract the two vectors, so the node it use is Vector - Vector.
                          https://docs.unrealengine.com/latest...r_2/index.html
                          Then you take the length of the difference vector above and add it to the curent Distance (with a Set). In pseudo-code:
                          Distance := Distance + Length(GetActorLocation() - LastPosition)
                          Then you check if Distance > StepDistance and if true you make a step sound. After making the step sound you do
                          Distance := Distance - StepDistance
                          so you are ready for the next step.
                          Last edited by vr_marco; 12-09-2017, 05:19 AM.
                          CTO | Head of VR Development - Visit us at http://humanxr.com
                          My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                          Comment


                            #14
                            Originally posted by vr_marco View Post
                            You have to subtract the two vectors, so the node it use is Vector - Vector.
                            https://docs.unrealengine.com/latest...r_2/index.html
                            Then you take the length of the difference vector above and add it to the curent Distance (with a Set). In pseudo-code:
                            Distance := Distance + Length(GetActorLocation() - LastPosition)
                            Then you check if Distance > StepDistance and if true you make a step sound. After making the step sound you do
                            Distance := Distance - StepDistance
                            so you are ready for the next step.
                            OK I think I'm close but I'll need your help answer a few questions and if you can answer each one I think I should get it then.

                            (1) When you say "You have to subtract the two vectors, so the node it use is Vector - Vector." Do you mean this?

                            Click image for larger version  Name:	Capture9.JPG Views:	1 Size:	12.6 KB ID:	1397684
                            Yes or no?

                            (2) When you say "Then you take the length of the difference vector above and add it to the curent Distance (with a Set)." Do you mean this?

                            Click image for larger version  Name:	Capture10.JPG Views:	1 Size:	31.1 KB ID:	1397685

                            If you didn't mean to set the distance float then can you tell me exactly what you mean by current distance (with a set) how do I know what the current distance is?

                            (3) When you say "Then you check if Distance > StepDistance and if true you make a step sound." Do you mean this?
                            Click image for larger version  Name:	Capture11.JPG Views:	1 Size:	65.0 KB ID:	1397686

                            (4) What does this ":=" mean?
                            Attached Files
                            Last edited by tcla75; 12-09-2017, 12:10 PM.

                            Comment


                              #15
                              Good, you are almost there!
                              Answers:
                              (1) yes!
                              (2) no, you have to add the Length of the difference vector to Distance and assign (Set) the total to Distance. Basically you keep adding the magnitude of the last movement to Distance until (3) is true.
                              (3) no, you have to compare Distance with StepDistance, not with itself. StepDistance is a new float var you set to, say, 50 (meaning one step sound every 50 cm of movement). And between Set Distance and the Branch, you need to assign (set) Get Actor Location to Last Position so you are ready for the next frame. Remember you are working into an Event Tick.
                              (4) After you have produced the step sound, you have to assign (Distance - StepDistance) to Distance. The symbol := means assign to or, in UE4 terminology, Set. This is needed to reset the Distance variable and restart adding to it until the next step occurs.
                              Last edited by vr_marco; 12-09-2017, 05:33 PM.
                              CTO | Head of VR Development - Visit us at http://humanxr.com
                              My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                              Comment

                              Working...
                              X