Exemplo n.º 1
0
//if you stay inside the trigger
    void OnTriggerStay(collider other)
    {
        if (other.CompareTag = ("Player"))
        {
            Debug.Log("Lets stay here");
        }
    }
Exemplo n.º 2
0
//when youre leaving the hit object
    void OnTriggerExit(collider other)
    {
        if (other.CompareTag = ("Player"))
        {
            Debug.Log("Lets exit");
        }
    }
Exemplo n.º 3
0
//if collide with coin increase score
    void OnTriggerEnter(collider other)
    {
        if (other.CompareTag = ("Coin"))
        {
            score++;
        }
    }
Exemplo n.º 4
0
    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
    }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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()
    {
      
    }
}
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     rb2d     = GetComponent <Rigidbody2D>();
     Collider = otherGameobject.GetComponent <collider>();
     cam      = playercam.GetComponent <camera>();
 }
Exemplo n.º 8
0
 void onTriggerEnter2D(collider other)
 {
 }
Exemplo n.º 9
0
    void OnTriggerEnter(collider c)

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