Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question Raycst a specific collider

Discussion in 'Physics for ECS' started by argibaltzi, Jan 1, 2023.

  1. argibaltzi


    Nov 13, 2014

    Is it possible in dots to raycast a specific collider to see if that object intersects?

    The gameobject physics have a collider.RayCast function but i can't find any dots

  2. calabi


    Oct 29, 2009
    You should look in the Unity Physics samples but it involves you getting the colliderworld and then something like this.

    if (collisionWorld.CastRay(RayInput, ref RaycastHits))

    You would also have to arrange the collision filters correctly, and there might be a problem where if the physics shapes are overlapping the CastRay will return all the hits no matter the filter and you might have to identify the specific object with a tag or something(I don't know if thats changed or not yet).