I'm just about to implement a laser weapon so I started scanning the forum about ray casting. Apart from the [AS3 contribution]
by BorisTheBrave, the way described [here]
seems to be the way to go.
Although the World.query(..) method is probably good enough for me already I was wondering if someone has already implemented Shape.TestSegment(...) in Java (of which currently only the out-commented signature can be found in the Java port svn repository).
Er...hehe. My bad.
I put those bits of code aside "for the moment" while updating to 2.0.1 because they're not entirely straightforward to translate (a float pointer is passed as a parameter to hold one of the results, so I have to create a RaycastResult holder class to do something similar in Java), and I completely and utterly forgot about going back to finish them up.
I'll try to do this before I do a full update with the things that have changed since 2.0.1, but it might be a couple weeks before I can get to it (I just took on a new contract this week so I'm pretty busy - gotta pay the bills once in a while!). I'll almost certainly port BorisTheBrave's raycasting contributions as well, since they make things very usable and quick.
That said, if anyone has already brought the code over, I'd happily include a patch, as long as it works.