Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Dylised |
i want to make a game that has multiple floorings; tiles, concrete, wood, carpet
and have different sounds on what i walk on.
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Dylised |
i want to make a game that has multiple floorings; tiles, concrete, wood, carpet
and have different sounds on what i walk on.
Reply From: | stormreaver |
I haven’t actually done it myself, so this is more of a stream-of-consciousness reply.
I would approach this by embedding the walking sound into the scene class that represents each flooring. Have a raycast emitted from the player downward towards the floor. When the raycast indicates a collision with the floor, get the collision object (which will be the floor’s scene object) which will contain the walking sound to play, and play it.