Skip to content

Instantly share code, notes, and snippets.

@IshidaGames
Created September 19, 2019 09:32
Show Gist options
  • Save IshidaGames/fa5a989beeb5cb2610f8d7d07e9b16a1 to your computer and use it in GitHub Desktop.
Save IshidaGames/fa5a989beeb5cb2610f8d7d07e9b16a1 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collision : MonoBehaviour {
Camera cam;
GameObject mainCamObj;
void Start()
{
cam = Camera.main;
mainCamObj = Camera.main.gameObject;
}
//OnTrigger,OnCollisionだと衝突している間
//Enterだと衝突した瞬間
//Stayだと衝突している間
//Exitだと衝突が終わった瞬間
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Right")
{
}
}
private void OnCollisionEnter(UnityEngine.Collision collision)
{
if(collision.gameObject.tag == "Left")
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment