I'm working on a material-based footstep system for my game, but am running into a problem with it. In my setup, I have a raycast pointing towards the ground which, through some janky setup, get's the collider's material metadata to determine the surface_type (what sounds to play). The issue is that if the player stands on the edge of say, a cube, and the raycast isn't colliding with anything, the footstep system will just play the previously detected material sound.
I'm trying to get the collision contact points of the character, and move the raycast's X and Z position to the center of those contact points to get the material so that way the proper material sounds are played. I tried using get_slide_collision(i).get_position(), but it doesn't constantly update when the player is moving (it only detects when the player lands on a surface, which is useful for another thing), and it doesn't detect RigidBody3D. If anyone has any ideas, I'm open to them. If any code snippets are required, I'll supply them upon request. Thank you!