Search Unity

Bug ECS Character Controller fails to detect ground plane collider.

Discussion in 'Physics for ECS' started by Dainofel, Mar 29, 2023.

  1. Dainofel

    Dainofel

    Joined:
    Oct 12, 2019
    Posts:
    35
    Hello,

    I am currently using Unity 2022.2.11, ECS 1.0, and the Character Controller (old Rival).

    I am running into an issue I can't manage to fix. Everything works fine - except when I move the character, the Kinematic Character Body becomes Ungrounded.

    I investigated and what's ungrounding it is the bool "isMovingTowardsNoGrounding"

    Apparently, when the character moves, the Controller thinks it is moving towards a place where it will not be grounded, so it flags it as ungrounded.

    The reason it does this is because it does a raycast where it thinks the character will be, and it finds nothing. Even though it is going through the plane that serves as a terrain. The character actually collides and is able to walk around it, but the check itself doesn't find the plane.

    I tinkered with it and even with my own cast, I can't detect the plane. I tried changing the physics layers and with a custom filter, but I cannot detect it.

    I did a check on physics world to see if the plane existed, and it does. It appears on the list of bodies in the world just fine. But the RayCast itself is not colliding against it.

    I checked the position of the raycast with a DrawRay, and it goes through the plain.
    I have modified the filter to be part of all layers, just the ones needed, still nothing.

    Any ideas on what could be causing it not to detect the plane? Any insight is appreciated.


    Edit: Nevermind, I actually found the issue - the Collider was set to a box instead of a plane, so the raycast was going right through it. I switched to plane and it collides with it now.
     
    Last edited: Mar 29, 2023