Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
Can't get Unity Physics2D.BoxCast(NonAlloc) to register hits where RayCast works

In Unity (2019.2) I'm trying to use a boxcast on a beam weapon of width > 0. Using a raycast for this beam test works correctly, but the BoxCast returns zero results.

I'm not using any depth, distance, or layermask filters.

 colCountRay = Physics2D.RaycastNonAlloc(e.pos, Vector2.up, collsRay);

...correctly returns the hit objects, populating collsRay and setting colCountRay to the number of hit objects. But replacing that rayCast with this...

 colCountRay = Physics2D.BoxCastNonAlloc(e.pos, Vector2.right, 0, Vector2.up, collsRay);

...colCountRay is zero

I'm using this script to visualise the box cast and it's overlapping correctly...

https://answers.unity.com/questions/1156087/how-can-you-visualize-a-boxcast-boxcheck-etc.html

I've used boxcast before in another game so I'm completely stumped here! All the tested objects have 2D colliders and a kinematic RigidBody2D. Physics2D layer filters are enabled in Settings for collisions between all objects, although that shouldn't affect the boxCast results.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Looks like you are casting a box with height 0? Could you try to use a non-zero sized box for the casting, and see if that works?

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda