I want to verify, what Gameobject is colliding, if it with the floor then my hero doesn’t die.
What happends in my level:
The player walk to the right until a trigger is set and give gravity to my chandelier,if the chandelier hits the floor the player can then push it and use it to jump accros something.(what happens is that when the chandelier comes in contact it destroys my player even after touching the floor)
using UnityEngine;
using System.Collections;
public class Collider : MonoBehaviour {
bool kill = true;
public GameObject floor;
public GameObject Chandelier;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter ()
{
//I want to verify here with what GameObject its colliding ,if its the floor then kill = false
Debug.Log ("Collide");
if (kill == true) { well if it hits the floor it won't go to my kill fuction
Killing();
}
}
void killing(){
Destroy(Hero);
Destroy (Shadow);
}
}