Skip to content

Instantly share code, notes, and snippets.

@slipster216
Created December 15, 2017 04:50
Show Gist options
  • Save slipster216/f5caba13260b26f49242192b29983d86 to your computer and use it in GitHub Desktop.
Save slipster216/f5caba13260b26f49242192b29983d86 to your computer and use it in GitHub Desktop.
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.
@imtomgamedev
Copy link

!verify IN010002663299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment