Sound of steps in different fields? (Textures)

Blitz3D Forums/Blitz3D Beginners Area/Sound of steps in different fields? (Textures)

Yue(Posted 2012) [#1]
I'm trying to implement different sounds for the character according to the texture where you are, the question is with the command GetBrushTexture (...) you can do that?


Yasha(Posted 2012) [#2]
Yes, but you might find it more efficient to create a 'materials' system, where surfaces are assigned a 'material' object which contains things like sound, effects, stealth radius, friction, any other relevant features... So you aren't having to work this out from the texture: ideally it's the texture which should visually reflect the material of an object, not the other way round.

Otherwise you'd need to use texture handles as keys to some kind of association list... A bit more complicated, a bit slower, and a lot less clean because it's conceptually backwards, making surface attributes the responsibility of a texture (which gets doubly odd once you want multiple textures to make the same sound, e.g. Rusty metal sounds the same as clean metal), rather than a texture simply be the visualisation of what the material is.


Yue(Posted 2012) [#3]
I can not understand the material system, when for example I have a platform with triangles, as I get to the juegador collide with these triangles make a different noise.




PowerPC603(Posted 2012) [#4]
You could also use the entity's name to store this information.
For the water surface and metal surface you'll need 2 separate meshes in this case.
Make those entities pickable and do a linepick straight down.

Just get the name of the entity that has been picked and check whatever material is stored there.
You could put a "W" as the first char of the entityname for water surfaces and a "M" for metal surfaces.
Then you can check if the first char in the entityname is a W or an M and play the sound that you need.

You can combine several things like this in the entityname to store more information, should it be needed for other purposes.

You can store the name using NameEntity when you're loading the meshes and use EntityName to get it back when you did your linepick.


Charrua(Posted 2012) [#5]
one aproach i use is:

make a list of TypedVariables with all the fields you need for an entity

then assign the Handle of that Object (element in the list of typed variables) as the name of the entity.

then when you get an entity, via line pick or camera pick, collision or whatever method, you can use the name of the entity with the Object function and get the object (typed variable) wich describes the entity:

an example



Juan


John Blackledge(Posted 2012) [#6]
See this thread:
http://www.blitzbasic.co.nz/Community/posts.php?topic=27498#288333