Fixed Contraint
Posted: Sat Mar 21, 2020 1:58 pm
Hi to everyone! I'm new with bullet and I'm using BulletSharp. I'm trying to build a simple simulation where objects fall into a box. This box consists of five walls. I would like to lock these walls in order to actually make a box. I tried to make it using both FixedConstraint and Generic6DofSpringConstraint but the constraints are not applied. I'm definitely forgetting something but I don't understand what.
This is the code I used (note that wall is a List of RigidBody and the fourth element of wall is the floor of the box):
Thanks in advance
This is the code I used (note that wall is a List of RigidBody and the fourth element of wall is the floor of the box):
Code: Select all
for (int i = 0; i<4;i++)
{
var constraint = new Generic6DofSpringConstraint(wall[i], wall[i], Matrix.Identity, Matrix.Identity, true)
{
LinearLowerLimit = new Vector3(1,1,1),
LinearUpperLimit = new Vector3(-1,-1,-1),
AngularLowerLimit = new Vector3(1,1,1),
AngularUpperLimit = new Vector3(-1,-1,-1)
};
//var constraint = new FixedConstraint(wall[4], wall[i], Matrix.Identity, Matrix.Identity)
//{
// LinearLowerLimit = new Vector3(1, 1, 1),
// LinearUpperLimit = new Vector3(-1, -1, -1),
// AngularLowerLimit = new Vector3(1, 1, 1),
// AngularUpperLimit = new Vector3(-1, -1, -1)
//};
colWorld.AddConstraint(constraint);
}