Ray Cast error when there are no entities.
Posted: Mon Aug 22, 2011 3:31 pm
If I cast a ray after removing the last entity in the scene/space then I get the following error:
Steps to error:
Maybe needs a check for the current entity count in the method?
in the following method:Object reference not set to an instance of an object.
Code: Select all
public bool RayCast(Ray ray, float maximumLength, IList<BroadPhaseEntry> entries)
{
hierarchy.root.GetOverlaps(ref ray, maximumLength, entries); // <------ HERE
return entries.Count > 0;
}
Code: Select all
BEPUphysics.Entities.Prefabs.Box box = new BEPUphysics.Entities.Prefabs.Box(Vector3.Zero, 1, 1, 1);
space.Add(box);
space.Remove(box);
if (space.RayCast(new Microsoft.Xna.Framework.Ray(cursorRay.Origin, cursorRay.Direction), 1000.0f, results))
// error