Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Physics2D.BoxCast

Hello guys/girls.

I am trying to Physics2d.Boxcast under of my players feet. (actually little bit down then his feet) in Unity Engine.

So far i am strugline with it can't implement it properly its always hitting at wrong spot.

my code : -

 hit = Physics2D.BoxCast(transform.position - new Vector3(0, 2f, 0),new Vector2(2,5) ,0, Vector2.down);


    if (hit)

    {

      GameManager.instance.EnableChokeButton();

      tempTarget = hit.transform;


      Debug.DrawLine(transform.position, hit.point, Color.red);

    }

    else

    {

      GameManager.instance.DisableChokeButton();

      tempTarget = hit.transform;


    }


Any one can tell me how to box cast under Players feet. also i don't know what i need to put in box angle thing.

Sign In or Register to comment.