Created
December 15, 2017 04:50
-
-
Save slipster216/f5caba13260b26f49242192b29983d86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also figured out how to enter the hole. Just add a trigger zone in front of your hole and add this code to a script and add the script to your trigger zone. | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class EnterHole : MonoBehaviour { | |
public Collider player; | |
public TerrainCollider tCollider; | |
void OnTriggerEnter (Collider c) { | |
if (c.tag == "Player") { | |
Physics.IgnoreCollision(player, tCollider, true); | |
} | |
} | |
void OnTriggerExit (Collider c) { | |
if (c.tag == "Player") { | |
Physics.IgnoreCollision(player, tCollider, false); | |
} | |
} | |
} | |
Make sure your character controller has a Player tag and add your player and terrain in the inspector for your trigger zone. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
!verify IN010002663299