Hi!
I’m currently working on a personal project, and I’m losing my head regarding collision layers and physics casts. Here is my setup:
I have a 2D character with the following properties: a rigidbody, a circle collider and the ‘Character’ layer.
Screenshot: Screenshot - e45978dc6921e95d601e0fb9802ea74a - Gyazo
I also have a several platforms, all having an edge collider. All of these are currently on the ‘Default’ layer. In my Character script I have an IsGrounded method which uses a CircleCast() to check for the ground.
Code: public bool IsGrounded { get { RaycastHi - Pastebin.com
-
Here is my first problem. If I change the layer for my floor platform from ‘Default’ to ‘Platforms’, my IsGrounded breaks. It will not return any colliders. This confuses me since my CircleCast() checks on the ‘Platforms’ layer, right?

Screenshot (Physics2D Settings included): Screenshot - f3f290f659996ca0568258a502c629e5 - Gyazo -
Now comes my second problem. My Character script will also animate and move my character, based on some simple logic. My next step was to make the character climb a ladder and afterwards make him move again. This works… For one ‘Lyker’ instance. If I create another instance of the same ‘Lyker’ prefab, and make them both climb the ladder, one will succeed and one will fail, sometimes getting stuck against the edge collider or just failing through all floors. This depends on the place where I put him.
Video:
My complete Character code can be viewed here: using UnityEngine;using System.Collections;public class Character : MonoBe - Pastebin.com
I hope I’ve explained it well enough. If there’s anything you need to know more, just ask, any help is appreciated.
Also, no hate on the graphics, it was the easiest to find and animate. ![]()