Snow Boarder - Another Way To Fix Barry's Head Collider

I’ve seen lots of great ways that others have shared to fix the Barry head collider challenge solution. For anybody looking for a solution that does not use any code that hasn’t yet been taught in the course, here’s my solution. (I am not using VS Code so in the images below, the arguments will be different (collision vs. other) but it’s the same thing.)

1.If you still have the Circle collider for the head attached to the Player parent, delete it.
2. Create a CircleCollider2D on the Boarder_top child object. Do NOT set it to Is Trigger.
3. Attach the CrashDetector script to Boarder_top, not the Player parent.

  1. Use the OnCollisionEnter2D function instead of OnTriggerEnter2D so that the head doesn’t pass though the ground.

Barry_Border_top_CrashDetector

Merry GameDev’ing!

3 Likes

Privacy & Terms