Issues :(

I’m having issues with the crash detection not sending a log message does anyone know why it might not be working??

That could be one of many things.

  • Is this script attached to the character?
  • Is it on the same game object as the collider?
  • Is the collider marked as a trigger?
  • Does the character have a rigidbody?
  • Does the ground have a ‘Ground’ tag?

Any one of these things could cause the trigger to not fire

Ah thanks I didn’t notice the collider wasn’t marked as a trigger its detecting it now but now the whole character is glitching into the ground when I flip over D:

Yes, this is a common issue from this course. This is because triggers don’t affect the physics. Rick’s does not go through the floor, but I don’t think anyone has figured out why.

You have 2 options;

  • Remove trigger again and change the code to OnCollisionEnter2D instead of OnTriggerEnter2D (note that the parameter will change from Collider2D to Collision2D), or
  • Copy the collider and don’t make it a trigger, so you have both a trigger collider and a normal collider. The trigger collider will do the message and the normal collider will prevent the head from going through the floor
1 Like

Just duplicated it and it works like a dream now thanks alot :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms