I know collisions have changed a little bit in unity 5 but i cant seem to get this to work at all
im making a 3d rail shooter, and there are objects on the ground that when the players ship collides with, are supposed to subtract health from the player.
the players ship is an empty game object, with the prefab for the ship as a child which has a rigidbody(isKinematic on) and a box collider(not trigger)
the object the player is colliding with is a prefab of an arch (that i removed the mesh collider from) this has a child which is an empty gameobject that i attached the rigidbody (isKinematic on) and the two scripts(one of which should decrease the players health) This emptyGameObject has 5 empty game objects as children, each of which has a box collider(each one is for a different part of the arch). the box colliders are currently not set to isTrigger.
these are the two scripts i attached to my parent game object that is holding all of the box colliders
using UnityEngine;
using System.Collections;
public class DamagePlayerOnCollision : MonoBehaviour{
public float damageAmount = 1.0f;
public float coolDownTime = 1.0f;
private bool inCoolDown = false;
void onCollisionEnter()
{
Debug.Log ("COLLIDED!!!!!!!!!!!!!!!!!!!");
if (!inCoolDown) {
HealthManager.Instance.DamagePlayer (damageAmount);
inCoolDown = true;
Invoke ("Uncool", coolDownTime);
}
}
void Uncool()
{
inCoolDown = false;
}
}
and here is the other one
using UnityEngine;
using System.Collections;
public class DamagePlayerOnTrigger : MonoBehaviour{
public float damageAmount = 1.0f;
public float coolDownTime = 1.0f;
private bool inCoolDown = false;
void onTriggerEnter()
{
Debug.Log ("COLLIDED!!!!!!!!!!!");
if (!inCoolDown) {
HealthManager.Instance.DamagePlayer (damageAmount);
inCoolDown = true;
Invoke ("Uncool", coolDownTime);
}
}
void Uncool()
{
inCoolDown = false;
}
}
i am aware that only one of these codes should be used for this to work, however, neither one of them does and Debug.Log never prints anything when the players ship collides with the object. What do i need to do for the game to recognize the collisions(Again, I am using Unity 5, not 4).