Discuss any questions about BEPUphysics or problems encountered.
Spankenstein
Posts: 249 Joined: Wed Nov 17, 2010 1:49 pm
Post
by Spankenstein » Sat Jun 30, 2012 10:14 am
The 'BoundingBoxForceFieldShape' class in the source has the following method:
Code: Select all
public override IList<Entity> GetPossiblyAffectedEntities()
{
affectedEntities.Clear();
ForceField.QueryAccelerator.GetEntries(BoundingBox, affectedEntries);
for (int i = 0; i < affectedEntries.count; i++)
{
var EntityCollidable = affectedEntries[i] as EntityCollidable;
if (EntityCollidable != null)
affectedEntities.Add(EntityCollidable.Entity);
}
affectedEntries.Clear(); // ERROR?!
return affectedEntities;
}
afftectedEntries is cleared before returning, this doesn't appear to be what was intended?
Norbo
Site Admin
Posts: 4929 Joined: Tue Jul 04, 2006 4:45 am
Post
by Norbo » Sat Jun 30, 2012 3:20 pm
The AffectedEnt
ries list gets cleared, and the AffectedEnt
ities list gets returned. The entries list doesn't need to be kept around since not all entries are entities, and all the entities have been extracted already.
That similarity puzzled me for a while too
Spankenstein
Posts: 249 Joined: Wed Nov 17, 2010 1:49 pm
Post
by Spankenstein » Sat Jun 30, 2012 4:56 pm
Ooops
Now I see. Thought I'd read it correctly too but alas no.