I'm getting a weird error and I can't figure out what's causing it.
If I set LocalInertiaTensorInverse to Matrix3x3() and then change the Mass value I get the following error:
"Function does not accept floating point Not-a-Number values." in GetBoundingBox of the BoxShape class.
The stack trace is as follows:
at System.Math.Sign(Single value)
at BEPUphysics.CollisionShapes.ConvexShapes.BoxShape.GetBoundingBox(RigidTransform& shapeTransform, BoundingBox& boundingBox)
at BEPUphysics.Collidables.MobileCollidables.ConvexCollidable`1.UpdateBoundingBoxInternal(Single dt)
at BEPUphysics.Collidables.MobileCollidables.EntityCollidable.UpdateBoundingBox(Single dt)
at BEPUphysics.OtherSpaceStages.BoundingBoxUpdater.UpdateSingleThreaded()
at BEPUphysics.MultithreadedProcessingStage.Update()
at BEPUphysics.Space.DoTimeStep()
at BEPUphysics.Space.Update()
I've tried debugging (in single threaded mode) but it doesn't seem to occur when I do, which makes me think it's a timing issue.
Any ideas?
Thanks.
CJ.
Setting mass after LocalInertiaTensorInverse - error
Re: Setting mass after LocalInertiaTensorInverse - error
You're changing the mass? Are you changing the amount of energy as well, because otherwise E=MC squared's going to get all upset and have a tantrum.
It's simple, just take the hydraulic phase ship emulator and attach it to the photon particle emitter, BAM, new tower!
Re: Setting mass after LocalInertiaTensorInverse - error
No I'm adjusting the speed of light to compensate. LOL!Fe_Yoshi wrote:You're changing the mass? Are you changing the amount of energy as well, because otherwise E=MC squared's going to get all upset and have a tantrum.
I've narrowed down the issue to the call to Solver.Update(). It appears that InertiaTensorInverse is somehow getting set to NaN. Now I just need to find where, how and why!
Re: Setting mass after LocalInertiaTensorInverse - error
It seems that when I set LocalInertiaTensorInverse = new Matrix3X3()... it also resets LocalInertiaTensor to all zeros as well.... which I presume the triggers LocalInertiaTensorInverse to become NaN somewhere but I can't yet see where.
Sometimes when I'm debugging it seems to prevent the error from occurring.... aagghh! (actually that could have been down to my numptiness)
I get the feeling that what happens is when I change the mass it then recalculates the LocalInertiaTensorInverse from the LocalInertiaTensor, which being zero will mean that LocalInertiaTensorInverse becomes NaN (or effectively infinite).
So now the question is, how can I get it to do it the other way around (to calculate LocalInertiaTensor from LocalInertiaTensorInverse)?
Sometimes when I'm debugging it seems to prevent the error from occurring.... aagghh! (actually that could have been down to my numptiness)
I get the feeling that what happens is when I change the mass it then recalculates the LocalInertiaTensorInverse from the LocalInertiaTensor, which being zero will mean that LocalInertiaTensorInverse becomes NaN (or effectively infinite).
So now the question is, how can I get it to do it the other way around (to calculate LocalInertiaTensor from LocalInertiaTensorInverse)?
Re: Setting mass after LocalInertiaTensorInverse - error
Ok, here's the chain of events...
I set LocalInertiaTensorInverse to zeros...
which sets LocalInertiaTensor to zeros also...
I change the Mass...
which calls BecomeDynamic(float mass, Matrix3X3 localInertiaTensor)...
which sets LocalInertiaTensor = localInertiaTensor...
which in turn recalculates LocalInertiaTensorInverse to NaN!!
At least I now understand what's happening. No idea how to fix it though.
I set LocalInertiaTensorInverse to zeros...
which sets LocalInertiaTensor to zeros also...
I change the Mass...
which calls BecomeDynamic(float mass, Matrix3X3 localInertiaTensor)...
which sets LocalInertiaTensor = localInertiaTensor...
which in turn recalculates LocalInertiaTensorInverse to NaN!!
At least I now understand what's happening. No idea how to fix it though.
Re: Setting mass after LocalInertiaTensorInverse - error
Thanks for the report, this should be fixed in the development version: http://bepuphysics.codeplex.com/SourceC ... evelopment
Re: Setting mass after LocalInertiaTensorInverse - error
That was quick! Many thanks Norbo. Great work as always.