Quantcast
Channel: Answers by "RedDevil"
Viewing all articles
Browse latest Browse all 92

Answer by RedDevil

$
0
0
#pragma strict var footsteps : PlayerFootsteps; var WoodFloor : BoxCollider; function Start () { WoodFloor = GameObject.Find("Wood Floor Trigger").GetComponent(BoxCollider); footsteps = GameObject.Find("First Person Controller").GetComponent(PlayerFootsteps); } function OnTriggerEnter (WoodFloor) { if (col.tag == "Player") { footsteps.OnWood = true; } Debug.Log ("Entered Trigger"); } function OnTriggerExit (Collider col) { if(col.tag == "Player") { footsteps.OnWood = false; } Debug.Log ("Exited Trigger"); } This detects the colision with the player so you must asign the player with a Player tag.

Viewing all articles
Browse latest Browse all 92

Trending Articles