diff options
Diffstat (limited to 'Other/NavMeshTest/Assets/Scripts/MovingPlatform.cs')
-rw-r--r-- | Other/NavMeshTest/Assets/Scripts/MovingPlatform.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Other/NavMeshTest/Assets/Scripts/MovingPlatform.cs b/Other/NavMeshTest/Assets/Scripts/MovingPlatform.cs new file mode 100644 index 0000000..6907636 --- /dev/null +++ b/Other/NavMeshTest/Assets/Scripts/MovingPlatform.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class MovingPlatform : MonoBehaviour +{ + + private void OnTriggerEnter(Collider other) + { + + Debug.Log("trigger"); + + if(other.gameObject.CompareTag("Player")) + { + other.gameObject.transform.SetParent(transform); + } + + } + + private void OnTriggerExit(Collider other) + { + if (other.gameObject.CompareTag("Player")) + { + other.gameObject.transform.SetParent(null); + } + } + +}
\ No newline at end of file |