Problems with DynamicBinaryHierarchy

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
BrianL
Posts: 54
Joined: Wed Jun 25, 2008 4:41 pm
Location: Panama City Beach, FL

Problems with DynamicBinaryHierarchy

Post by BrianL »

I see that the sample/demo app uses this BroadPhase. I just updated to version 0.9 and can't get the DynamicBinaryHierarchy to run. I created a default XNA game app and added BepuPhysics as a reference. I set it up so that the only things I do are create the Space with a new DynamicBinaryHierarchy and then call update on the Space with a delta time of 1/60 and I get a 100% repro exception. I tried searching the forums to see if anyone else has encountered this, but I didn't find anything. So hopefully this isn't a duplicate.

Here's a copy of the exception:

System.ArgumentOutOfRangeException was unhandled
Message="Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
Source="mscorlib"
ParamName="index"
StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at BEPUphysics.BroadPhases.DynamicBinaryHierarchy.DynamicBinaryHierarchyNode.binaryUpdateNode()
at BEPUphysics.BroadPhases.DynamicBinaryHierarchy.updateControllers(Single dt, Single timeSinceLastFrame)
at BEPUphysics.Space.updateControllers(Single dt, Single timeSinceLastFrame)
at BEPUphysics.Space.updateCCD(Single timeSinceLastFrame)
at BEPUphysics.Space.updateWithoutInternalTimeSteps(Single timeSinceLastFrame)
at BEPUphysics.Space.update(Single timeSinceLastFrame)
at PhysicsTest.Game1.Update(GameTime gameTime) in C:\Projects\PhysicsTest\Game1.cs:line 87
at Microsoft.Xna.Framework.Game.Run()
at PhysicsTest.Program.Main(String[] args) in C:\Projects\PhysicsTest\Program.cs:line 14
InnerException:
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Problems with DynamicBinaryHierarchy

Post by Norbo »

This is fixed in the upcoming v0.10.0; it's caused by the engine not yet having any entities in it and the DBH trying to access the first entity in the entities list. A workaround is to add at least 1 entity before updating the space.
Post Reply