Hello everyone, In my FPS game I made a Jump action for the player I want to play a sound when the player hits the ground. I don’t know how to detect that so can you please tell me how to do that in c#?
Thanks
(I’m still a beginner)
Hello everyone, In my FPS game I made a Jump action for the player I want to play a sound when the player hits the ground. I don’t know how to detect that so can you please tell me how to do that in c#?
Thanks
(I’m still a beginner)
It depends on what component you use for your character. I’m assuming a character controller.
You need to create a script and implement a function called OnControllerColliderHit, then attach it to the player.
In that function, check if the collider is the ground and play if the player was previously jumping, play a sound.
You will probably want to associate a particular sound to particular surfaces (sand, wood, concrete …). I suggest you write a script that holds informations about the surface, like the sound.