Ok so I create 2 bodys
Then link them using a revolute joint as seen here
Code: Select all
Bodys.Add(new Box(new Vector3(0, 2, 0), 2f, 4f, 2f, 100));
//Bodys[0].mass = 0;
Bodys[0].dynamicFriction = 1.0f;
Bodys[0].staticFriction = 1.0f;
InitialPartStats.Add(new EntityPartStat(new Vector3(0, 0, 0), Quaternion.Identity));
Bodys.Add(new Box(new Vector3(0, 2, 1.2f), 0.5f, 3f, 0.1f, 15));
//Bodys[1].mass = 0;
Bodys[1].dynamicFriction = 1.0f;
Bodys[1].staticFriction = 1.0f;
InitialPartStats.Add(new EntityPartStat(new Vector3(0, 0, 1.2f), Quaternion.Identity));
//Connect the saw to the piston with a second axis joint.
//Revolute joints can be used to make axis joints (as it is here), but you can also use them to make hinges.
//Make the blade spin.
RevoluteJoint axisJoint = new RevoluteJoint(Bodys[0], Bodys[1], (Bodys[0].centerPosition + Bodys[1].centerPosition) / 2, Vector3.Forward);
axisJoint.motor.isActive = true;
axisJoint.motor.settings.velocityMotor.goalVelocity = 20;
axisJoint.motor.settings.maximumForce = 200;
Constrants.Add(axisJoint);
When this happens it goes though each object and kills there physics using this code here.
Code: Select all
public void KillPhysics()
{
for (int i = 0; i < Bodys.Count; i++)
{
if (Bodys[i] != null)
if (space.entities.Contains(Bodys[i]))
space.remove(Bodys[i]);
}
for (int i = 0; i < Constrants.Count; i++)
if (Constrants[i] != null)
if (space.solverUpdateables.Contains(Constrants[i]))
space.remove(Constrants[i]);
}
but only if I make both bodys dynamic if I comment out "//Bodys[0].mass = 0;" then it removes it fine...
Any idea what I am doing wrong? Or have a found some kind of super rare bug?