Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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).