Hi im currently trying to create a foot step system and am having trouble getting the name of a texture from the terrain. it currently works for renderers but not on terrains
this is what i currently do how can i do something simler on a terrain?
if (Physics.Raycast (transform.position, -Vector3.up , out hit)) {
if (hit.transform.gameObject.GetComponent<MeshRenderer> ()) {
Texture tex = hit.transform.gameObject.GetComponent<MeshRenderer> ().material.mainTexture;
if (tex.name.Contains("Grass")) {
groundType = GroundType.Grass;
}
if (tex.name.Contains("Rock")) {
groundType = GroundType.Rock;
}
if (tex.name.Contains("Metal")) {
groundType = GroundType.Metal;
}
if (tex.name.Contains("Snow")) {
groundType = GroundType.Snow;
}
}
}