Collision between two 2D objects.
I'm trying to create a very simple game and am attempting to add collision detection between 2D objects.
I've got a space ship, an enemy and a bullet.
I click, a bullet appears, hits the enemy - but I can't get anything to actually happen.
All the objects have a RigidBody2D attached and a polygon collider.
The collider has "Is Trigger" ticked.
I don't want any of the RigidBody physics to impact the objects - so I've turned off "Simulated".
In my script for the bullet and the enemy I have:
private void OnTriggerEnter(Collider other) { Debug.Log("Is triggered"); }
I've tried just about every combination of dynamic/kinematic/use full kinematic contact/IsSimulated and don't seem to be seeing any difference.
What am I missing - why am I never triggering anything?
Answer by Bong_Sao · Apr 06, 2018 at 11:52 PM
It actually triggers the following:
private void OnTriggerEnter2D(Collider2D other)
Subtle but important difference...
Your answer
Follow this Question
Related Questions
OnCollisionEnter2D not calling, but objects are colliding. 1 Answer
Rough time trying to detect collisions 1 Answer
Car "bugs" through ground 0 Answers
Checking collision before instantiating prefab 0 Answers
2D collision not working 0 Answers