Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Kinematic Character Controller With ECS

Discussion in 'Physics for ECS' started by xOrfe, Sep 2, 2023.

  1. xOrfe


    Apr 21, 2013
    Hello, I want to create a kinematic character controller with Unity ECS physics. In your opinion, what is the most efficient method for detecting the character's contacts? I'm considering using raycasts or spherecasts, but I'm not sure which one is less costly. What approach do you recommend?
  2. philsa-unity


    Unity Technologies

    Aug 23, 2022
    It's always a tradeoff between accuracy and efficiency. Raycasts are more efficient than shape casts, but they might not be able to solve certain problems that require more collision accuracy

    I'd recommend going with Collider casts and distance queries. The collider casts will sweep the character collider in the movement direction to detect movement collision, while the distance queries can be helpful for solving collisions that result from something else moving into the character.

    If you're interested there's also a ready-made ECS character controller available in the package manager:
    daniel-holz likes this.