Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How does Physics2D.BoxCast works? How can i reproduce it with gizmos?

Discussion in 'Scripting' started by luizcarlosfx, Jul 6, 2014.

  1. luizcarlosfx

    luizcarlosfx

    Joined:
    May 28, 2013
    Posts:
    15
    I'm trying to use unity3d Physics2D.BoxCast but I can't understand how it works. I tried to reproduce it drawing a box gizmo this way:
    Gizmos.DrawWireCube(Origin.position, Size);

    My BoxCast function looks like this:

    Physics2D.BoxCast(Origin.position, Size, Angle, Vector2.up);


    My real problem is the function Gizmos.DrawWireCube does not appear to really represent the ray of the function Physics2d.BoxCast

    I read the documentations here: http://docs.unity3d.com/ScriptReference/Physics2D.BoxCast.html but I can't understand what the direction attribute means.

    I hope someone can explain me. Thanks
     
    Last edited: Jul 6, 2014