My collision is not detecting
I want a message to display when my player hits an obstacle but the only collision detected is with the ground. This is the collision script I attached to the player. using UnityEngine;
public class PlayerCollision : MonoBehaviour {
void OnCollisionEnter()
{
Debug.Log("we hit something");
}
}
Answer by fiterpilot · Aug 15, 2017 at 12:08 AM
First thing I would do would be set the debug.log to also log what it hits. That was you know for sure what your object is hitting.
Next, are you sure that all the object have colliders?? If they do, are they box/sphere/capsule colliders? Unity seems to have some issues when it comes to mesh colliders and detectoin.
Finally, depending on what you are trying to do, set one to be a trigger. You can use the OnTriggerEtner function then.
Your answer
Follow this Question
Related Questions
Selective Collision Detection 2 Answers
Best way to do Collision detection when you have multiple enemies/allies around you 0 Answers
Smoothing collision rate 1 Answer
Can I detect a collision between two triggers on other objects 1 Answer
How to detect a collision. Coming back to using Unity after taking a break for a few years. 0 Answers