However using Entity.Mass does not set the mass. The most it does is make it kinematic if the value entered is between the boundaries specified.
The only way I know how to is by using the functions BecomeKinematic() and then BecomeDynamic(mass) right afterwards... which resets it back to 0,0,0 position.
This is highly annoying and would rather be able to avoid even if i reset the world Transform to the previous transform in the same.
For more info I have boxes that I want to move when the player pushes them upon pressing a certain key. Otherwise they do not move no matter what. Also I would like them to fall if they are pushed off a cliff for example.
So essentially the idea I have right now is to make them dynamic with a really high mass, and then onInteraction with the player they reduce their mass, move in a 1:1 ratio with the players velocity, and then go back to their old mass when released.
This also makes it so hitting other boxes does not force them to move because their masses are equal.
EDIT: I am sorry for this post I just realized that I am able to do it with primitive Entity types, but not a compoundBody.
I was decompositing a mesh into separate convexHulls and putting them into a compoundBody, even if the object just had one mesh/convexMesh.
but I can probably find a work around this.
EDIT 2: sorry for all the edits but here is my real problem now....
Code: Select all
// for debugging purposes I know this is Compound and I only want the first body because only one exists
BEPUphysics.Entities.Entity temp = ((BEPUphysics.Entities.CompoundBody)parent.PhysicsBody).SubBodies[0];
if (temp != null)
{
// the code reaches here without breaking but then breaks on this command
// giving me a system.ArgumentOutOfRange error
// temp is of type ConvexHull
temp.Mass = 25;
}
additional info: it looks to be a typical argument exception, happens in mscorlib.dll
says index can not = -1 or greater than size and of the collection.
also temp.Mass = -1 gives me the error that it can not make an entity in a compound body kinematic.
but instead use the functions at hand on the body. Which makes sense lol
