Game Development Community

Footstep sounds

by Daniel Neilsen · in Torque Game Engine · 10/08/2002 (12:59 pm) · 4 replies

Can someone please explain to me how to get different footstep sounds for different textures working?

It was my thoguht that somethign like this would work.

addMaterialMapping( "dirt_road" , "sound: 2" , "color: 0.46 0.36 0.26 0.4 0.0" );

but it does not seem to?
(ie. this would play sound 2)

#1
10/09/2002 (2:19 am)
After some investigation I have discovered that this code always returns -1 and hence, footpuffs and material specific sounds will never play.

TerrainBlock* tBlock = static_cast<TerrainBlock*>(rInfo.object);

               // Footpuffs, if we can get the material color...
               S32 mapIndex = tBlock->mMPMIndex[0];
               if (mapIndex != -1) 
			   {

Anyone have any experience in the terrainBlock info?
#2
10/09/2002 (5:21 am)
in my game there's always 1 footpuff and 1 sound playing for every move.. not depending on the texture you are standing on...except when you run forward,then it doesn't do anything at all. So...I guess I even have a bigger problem then you ;) I'll look into it soon tough.
#3
10/09/2002 (8:21 am)
Where did you put your dirt_road.jpg? i.e. if you have torque under C:\torque and have your game scripts under C:\torque\example\putyournamehere\etc. Did you put dirt_road.jpg under C:\torque\example? If it's under C:\torque\example\putyournamehere\data\some\thing\dirt_road.jpg then the addMaterialMapping should be adding "putyournamehere/data/some/thing/dirt_road". Otherwise, the index won't be valid because it can't find the file.

(Sorry, at work here.. not exactly being thorough.)
#4
10/09/2002 (1:19 pm)
Hi Ice
I tried the following combinations

addMaterialMapping( "~/data/terrains/grassland/grass" , "sound: 2" , "color: 0.46 0.36 0.26 0.4 1.0" );
addMaterialMapping( "trakers/data/terrains/grassland/grass" , "sound: 2" , "color: 0.46 0.36 0.26 0.4 1.0" );
addMaterialMapping( "~/data/terrains/grassland/grass.jpg" , "sound: 2" , "color: 0.46 0.36 0.26 0.4 1.0" );
addMaterialMapping( "/trakers/data/terrains/grassland/grass" , "sound: 2" , "color: 0.46 0.36 0.26 0.4 1.0" );

None of these seem to work. When you get home could you possibly post an example?