Footstep sound on different material

Blitz3D Forums/Blitz3D Programming/Footstep sound on different material

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Wesh - no need for loadanimmesh for static Meshes, just a waste of speed. So better use LoadMesh. yes, Linepick wil return the global mesh handle, but don't care! Simply use the PickedSurface() Command to find out what texture your player stepped on.

As I said, after loading the level you need to store all surfaces in an array. parallely you should store the used texture per surface. this way you can assign a sound to each surface. The reason why is the order of the surfaces of a mesh is never the same after loading - i mean, each time oyu load a mesh with multiple surfaces, the order of the surfaces is randomly diffrent. This might be a DirectX issue, however.

SO first parse all surfaces and store their handles in a array, you could also use a type, but imho tere is no need for slower types in this case.

then use the getbrush, gettexture and gettexturename functions to determine which texture files are used by which surface (see SaveB3D example in the code archives on how to use them) and bare in mind: getbrush and gettexture will create a copy of the brush or texture, so it must be frred after finding the texture path.
The texture path returned by gettexturename incudes the full path, so you might use t$=replace(path$,currentdir$(),"") to remove everything but the texture filename.

then you can run something like

if t$(i)="water.bmp" then
sndfile$(i)="water.wav"
snd(i)=loadsound(sndfile$(i))
endif

Tell me if there are still questions about this issue.