0

I have 4 BoxColliders on my character to detect wall/floor collision.

When collision detection is enabled for them, it causes the player to stick to walls and slopes aren't detected as ground.

HalfHalf
  • 3
  • 2

1 Answers1

1

You could make the box collider a trigger, but using box colliders for detecting ground ( floor ) isn't the best idea, you could try using a simple checksphere to check if the player is grounded or not. First make an empty game object, make sure it's a child of your character, and put it at its bottom. Then put this inside your character movement script, or just make a new script.

[SerializeField] private Transform GroundCheck;
[SerializeField] private LayerMask groundMask;
[SerializeField] private float groundDistance;

void Update()
{
        isGrounded = Physics.CheckSphere(GroundCheck.position,groundDistance,groundMask);
}
Kaufko
  • 40
  • 5