ink-inc / MagicMittelalterGame

An awesome game for awesome people
3 stars 1 forks source link

Material Matcher Ground (MMG) #104

Open Segelzwerg opened 4 years ago

Segelzwerg commented 4 years ago

We need a matcher that takes a material name (string), looks it up and returns a type (string) e.g. wood, stone, grass, sand ...

This is necessary so the sound system knows what sound to play while moving. I think there are several ways to do it and maybe we can discuss in a group call.

Segelzwerg commented 4 years ago

When starting Terrain Scene this happen:

[13:01:31:778] MissingComponentException: There is no 'Renderer' attached to the "Terrain_0_0-20191123-021535" game object, but a script is trying to access it.
You probably need to add a Renderer to the game object "Terrain_0_0-20191123-021535". Or your script needs to check if the component is attached before using it.
UnityEngine.Renderer.get_material () (at /home/builduser/buildslave/unity/build/Runtime/Export/Graphics/GraphicsRenderers.bindings.cs:133)
GroundDetector.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/Player/GroundDetector.cs:21)
Segelzwerg commented 4 years ago

When starting Terrain Scene this happen:

[13:01:31:778] MissingComponentException: There is no 'Renderer' attached to the "Terrain_0_0-20191123-021535" game object, but a script is trying to access it.
You probably need to add a Renderer to the game object "Terrain_0_0-20191123-021535". Or your script needs to check if the component is attached before using it.
UnityEngine.Renderer.get_material () (at /home/builduser/buildslave/unity/build/Runtime/Export/Graphics/GraphicsRenderers.bindings.cs:133)
GroundDetector.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/Player/GroundDetector.cs:21)

TheUnity.Engine.Collider other is a scriptable object in Assets/Gaia/GaiaTerrainLayers/. May one way to get some information about the ground is to check the name of it's Diffuse attribute.

image

which in this case contains the word Sand:

image