java - LibGdx RayCast box2d debug (visual on screen) -


can me?

i want see raycast in game screen (for debugging..).

what best way achieve that? please note use "box2d". , way draw stuff screen animation.. means need create "edgeshape"? , debug line?

please if there suggestions can give or ideas don't mind how implement, want proper way see raycast. not found way draw raycast, saw use batch.draw(); - guess won't work me, because way game work's box2ds shapes , animation? right?

thanks much!

   world.raycast(callback,     enemy.getbody().getposition(),              new vector2(enemy.getbody().getposition().x-500, enemy.getbody().getposition().y));    }     raycastcallback callback = new raycastcallback() {       @override       public float reportrayfixture(fixture fixture, vector2 point,             vector2 normal, float fraction) {           if(fixture.getbody().getuserdata() == modeltype.player) {             system.out.println("hey!");             return 0;          }          return -1;       } 

i debug shaperendrer:

shaperenderer.setprojectionmatrix(batch.getprojectionmatrix()); shaperenderer.begin(shaperenderer.shapetype.line); shaperenderer.line(raystart,rayend); shaperenderer.setcolor(color.red); shaperenderer.end(); 

i add same class, enemy is.

and taking care of points (the vector2):

world.raycast(raycastcallback, p1, p2); 

to updated, enemy moves.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -