Jul 17, 2013 at 8:27 AM
Edited Jul 17, 2013 at 8:43 AM
So I've been fiddling with this for a while, step #1 trying to do a check-line-segment-for-intersecting-bodies. This is what I have:
let res = ref true
fun (fixture: Fixture) (point: Vector2) (normal: Vector2) (fraction: float32) ->
if fixture.CollisionGroup <> -1s then
res.Value <- false
Sorry for the F#, but it should be reasonably clear what's going on (
makes a delegate
makes a mutable cell),. The idea is that i'll cast a ray, and if anyone hits it (in the correct collision group) i'll set my accumulator variable to "false". However, it isn't giving me the right answer: it's missing a lot of collisions
that should pick up. In particular, I'm trying to use it to replace the following code
.All(fun x -> x = null || x.CollisionGroup = -1s)
just makes an IEnumerable out of the two pints. This
pick up some of the collisions the previous snippet missed (albeit it'll miss some others). Am I doing something wrong? I've read through the docs and code and can't figure out what I'm doing wrong. In theory, the ray being cast should detect every
collision the two-point-check does, but that is clearly not happening. Could anyone give me any hints what's going on?
EDIT: I just checked the winding order problem (saw it in other posts) but my polygons are all BodyFactory polygons, so that shouldn't be a problem.