bug in class explosion

Apr 9, 2011 at 1:32 PM

in class explosion method Activate raise a runtime error.

 

                // RaycastOne
                bool hitClosest = false;
                World.RayCast((f, p, n, fr) =>
                                  {
                                      Body body = f.Body;

                                      if (!IsActiveOn(body))
                                          return 0;

                                      if (body.UserData != null)
                                      {
                                          int index = (int)body.UserData;//------> in userdata is present a istance of my class and in this point raise a cast exception
                                          if (index == 0)
                                          {
                                              // filter
                                              return -1.0f;
                                          }
                                      }

                                      hitClosest = true;
                                      shape = f;
                                      return fr;
                                  }, p1, p2);