when trying to go back to the "source" (ie: forces), I encounter something odd:
a dynamic entity (m=50) is put in the air (y=500), space has "standard" gravity (y=-9.81), no entity's personal gravity defined.
I have add a "hovering mode" (called levitation in the code), which either before and after or just after a space.Update call, nullify the linear momentum of the entity. Before update call let the gravity do its job for the last dt elapsed, also after update call remove the gravity action. I got both LM and LV = 0 (only y component is considered).
But, y position of the entity still slowly decrease (between -0.1 and -0.2 unit/s), with isFixedTimeStep = true or false and these engine settings only:
Space.Solver.IterationLimit = 100;
CollisionDetectionSettings.AllowedPenetration = 0.002f;
and BEPU binaries release from 15/06/2015 (1.4.0), using a snapshot from the 11/12/2015 gives the same result.
Entity is initially a capsule (build with CapsuleShape), I have also used a CylinderShape just to check, same result (for these two, if any angular velocity exists, it would be on the symmetry axis, Y), also with SphereShape and a BoxShape, not angular velocity observed.
Seen this thread, but can't get a dynamic entity, with a zero LM, to stay where it is.
Also, if I replace this line:
Code: Select all
demo.LinearMomentum -= demo.LinearMomentum;
Code: Select all
demo.LinearMomentum = BEPUutilities.Vector3.Zero;
demo.AngularMomentum = BEPUutilities.Vector3.Zero;
I just wish to understand what's happening there, is this an issue with my code or somewhere in BEPU or did I do something wrong ?
My entire solution is provided (not in demo format, sorry).
bonus question: in EntityBase code, I see LM is calculated with
Code: Select all
Vector3.Multiply(ref linearVelocity, mass, out momentum);
Should not be the LV be a result of LM. I'm pretty sure LV is quite easy to get when only gravity is applied to an entity, but with more complicated system like a rocket/plane engine, you can't get LV directly, at least if you have choose some accuracy.
Thanks.