- Home /
The question is answered, right answer was accepted
Footstep sounds system with a Vr touchpad movement system
Hello, i use the first person controller prefab from the Standard Unity Assets and modified the FirstpersonController Script by adding this code:
if (GvrControllerInput.IsTouching)
{
ddTouchpadPos = GvrControllerInput.TouchPos;
if (ddTouchpadPos.y < 0.5f - deadZone)
{
normalizedDDTouch = Vector3.ProjectOnPlane(cameraTransform.forward, Vector3.up) * 0.08f;
}
if (ddTouchpadPos.y > 0.5f + deadZone)
{
normalizedDDTouch = Vector3.ProjectOnPlane(cameraTransform.forward, Vector3.up) * -0.07f;
}
if (ddTouchpadPos.x < 0.5f - deadZone)
{
normalizedDDTouch = cameraTransform.right * -0.07f;
}
if (ddTouchpadPos.x > 0.5f + deadZone)
{
normalizedDDTouch = cameraTransform.right * 0.08f;
}
transform.localPosition += normalizedDDTouch;
}
now i want to play sounds for every meter the character moves i dont get how the footstep system in this prefab works so it does not work for me can you please help me. Thank you anyways :) (Sry for my english)i have no animation for my character and no model
Footsteep System from the Prefab:
private void ProgressStepCycle(float speed)
{
if (m_CharacterController.velocity.sqrMagnitude > 0 && (m_Input.x != 0 || m_Input.y != 0))
{
m_StepCycle += (m_CharacterController.velocity.magnitude + (speed*(m_IsWalking ? 1f : m_RunstepLenghten)))*
Time.fixedDeltaTime;
}
if (!(m_StepCycle > m_NextStep))
{
return;
}
m_NextStep = m_StepCycle + m_StepInterval;
PlayFootStepAudio();
}
private void PlayFootStepAudio()
{
if (!m_CharacterController.isGrounded)
{
return;
}
// pick & play a random footstep sound from the array,
// excluding sound at index 0
int n = Random.Range(1, m_FootstepSounds.Length);
m_AudioSource.clip = m_FootstepSounds[n];
m_AudioSource.PlayOneShot(m_AudioSource.clip);
// move picked sound to index 0 so it's not picked next time
m_FootstepSounds[n] = m_FootstepSounds[0];
m_FootstepSounds[0] = m_AudioSource.clip;
}
Edit: i read that there is no footstep sound in vr because thats annoying for users is that true?
Answer by BlakeSchreurs · Oct 05, 2017 at 12:11 PM
Your Edit actually gets to the hart of the problem: There are usually no footstep sounds in VR. The heart of it is this: The players have their own feet, and they know when they move (or don't move) their feet. If they hear footstep sounds, without having moved their feet, they are either usually distracted by it (it breaks immersion since their feet and the sounds don't line up) OR they think someone's following them / sneaking around. You're probably better off without those footsteps.
Follow this Question
Related Questions
is it possible to edit the Continuous Move provider (Action based) to add a jump feature? 1 Answer
how to not move on the x axis while not jumping 2 Answers
How can I guarantee a CharacterController never leaves the ground? 2 Answers
Charecter Controller like in Merry Bear game(Cube based game). 0 Answers
Stop animation when character controller hits walls 1 Answer