Beispiel #1
0
//if you stay inside the trigger
    void OnTriggerStay(collider other)
    {
        if (other.CompareTag = ("Player"))
        {
            Debug.Log("Lets stay here");
        }
    }
Beispiel #2
0
//when youre leaving the hit object
    void OnTriggerExit(collider other)
    {
        if (other.CompareTag = ("Player"))
        {
            Debug.Log("Lets exit");
        }
    }
Beispiel #3
0
//if collide with coin increase score
    void OnTriggerEnter(collider other)
    {
        if (other.CompareTag = ("Coin"))
        {
            score++;
        }
    }
    public IntersectData intersect(collider other)
    {
        // figure out what type of coliders the objects have and use the
        // appropriate function
        if (t == type.sphere && other.t == type.sphere)
        {
            return(((BoundingSphere)this).IntersectBoundingSphere((BoundingSphere)other));
        }

        return(new IntersectData()); //default null case
    }
Beispiel #5
0
 void OnTriggerEnter(collider other)
 {
     if (other.CompareTag = ("Player"))
     {//disable the object on collision
         cubeObject.SetActive(false);
         cubeObject2.SetActive(false);
         //set script inactive
         // this.gameObject.SetActive(false);
         //set csript active on collission
         player.GetComponent <FirstScript>().enabled = true;
         //diable this game object
         floor.GetComponent <MeshRenderer>().enabled = true;
     }
 }
Beispiel #6
0
  private void OnTriggerExit(collider other)
  {
    RotateOZbj.transform.RotateAround(new Vector3(1.45f, 0.0f, 5.6f), Vector3.up, -90);
    // params of Vector3 are axis of Hinge of the door
  
    // Start is called before the first frame update
    void Start()
    {
        
        
    }

    // Update is called once per frame
    void Update()
    {
      
    }
}
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     rb2d     = GetComponent <Rigidbody2D>();
     Collider = otherGameobject.GetComponent <collider>();
     cam      = playercam.GetComponent <camera>();
 }
Beispiel #8
0
 void onTriggerEnter2D(collider other)
 {
 }
Beispiel #9
0
    void OnTriggerEnter(collider c)

    {
        Debug.Log(c.gameObject.name);
    }