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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Physics2D.CircleCast() : Registering Object Hit [SOLVED]

Discussion in 'Scripting' started by renman3000, Mar 6, 2018.

  1. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,680
    Hi there,
    I am using CircleCast() for the first time. It has 7 variations of arguments you can pass into it. My question is, none contain a RaycastHit2D as an argument. I am getting the results I want, but I can't see how to mark the object hit.


    Thanks

    Code (csharp):
    1.  
    2.     if (Physics2D.CircleCast (transform.position, 1f, Vector2.right, 0, target_layerMask)) {
    3.             print ("[[[[[[[[[[ HIT SOMETHING?? ");
    4.         }
    5.  
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    From the docs..
    https://docs.unity3d.com/ScriptReference/Physics2D.CircleCast.html

    Is that what you meant?
     
  3. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,680
  4. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Hmm. I'm fairly certain that your code is incorrect..

    Did you read the doc or the part I quoted?