Problem with RayCastCallBack

Topics: User Forum
Aug 24, 2010 at 4:01 PM
Edited Aug 24, 2010 at 4:07 PM

I'm having an assertion error when calling a Raycast. I'm not calling the raycast inside the World Step (which usually is what gives me the error), I don't know what I'm I doing wrong :/

Here's the code, the Globals.CollidesWithHero(f) checks the collisioncategories of the fixture f. GameElementsControl is a static class containing the world among other global stuff. Can anyone help me to find what's wrong?

 

GameElementsControl.World.RayCast((f, p, n, fr) =>
            {
                Body body = f.Body;
                if (body.UserData != null)
                {
                    int index = (int)body.UserData;
                    if (index == 0)
                    {
                        // filter
                        return -1.0f;
                    }
                }

                if (Globals.CollidesWithHero(f))
                {
                    hitClosest1 = true;
                    return fr;
                }

                return 1.0f;
            }, point1, point2);

Edit: In case anyone is interested, here is the error :/

Aug 30, 2010 at 4:25 PM

Meh, solved it changing it by a Fixture.RayCast()... I guess