does libGDX box2dDebugRenderer renders ray?

175 Views Asked by At

I am using libGDX for hobby Game Development,I am using two stages one is for graphics and one is for box2d world with debugDraw, every box2d fixtures debugDraw well with their graphics but I cant debugDraw a raycast!, how can I easily achieve that?
THANK YOU.

1

There are 1 best solutions below

0
On BEST ANSWER

DebugDraw does not render RayCasts as they are not an object in the box2d world. It is more like a query and does not persist.

But you could use your starting vector and the the point of the RayCastCallback that is going stop the raycast to draw a line via DebugRenderer.line(a, b). Of course, if you want this line to show up more than one frame you have to store your vectors somewhere.