Skip to content

Instantly share code, notes, and snippets.

@Adamcbrz
Created May 18, 2020 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adamcbrz/c387b9a0c21e496e35f7fef9fd6a997b to your computer and use it in GitHub Desktop.
Save Adamcbrz/c387b9a0c21e496e35f7fef9fd6a997b to your computer and use it in GitHub Desktop.
public GameObject target;
void OnTriggerEnter()
{
CharacterController controller = target.GetComponent<CharacterController>();
if (controller != null)
{
controller.enabled = false;
target.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, target.transform.position.z + 2500);
controller.enabled = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment