void CreateParticles() { //ZeroBody zb = new ZeroShape(); BoxShape brick = new BoxShape(0.1, 0.1, 0.1); RigidBody fix = CreateBody(0, brick, new Vector3(0, 0, 0)); fix.SetSleepingThresholds(0, 0); fix.SetAnisotropicFriction(Vector3.Zero, AnisotropicFrictionFlags.FrictionDisabled); fix.Friction = 0; fix.SetDamping(0, 0); Random rand = new Random(); SphereShape ss = new SphereShape(particleSize); for (int xx = 0; xx < 115; xx++) { for (int yy = 0; yy < 90; yy++) { RigidBody r = CreateBody(1, ss, new Vector3(5 + xx * 0.51, 5 + yy * 0.51, 0)); r.Friction = 0.0; r.Restitution = 1; r.RollingFriction = 0; r.SetDamping(0.01, 0.1); Particles.Add(r); r.SetSleepingThresholds(0, 0); r.SetAnisotropicFriction(Vector3.Zero, AnisotropicFrictionFlags.FrictionDisabled); var c = new Generic6DofConstraint(fix, r, Matrix.Translation(1, 0, 0), Matrix.Translation(1, 0, 0), true); //c.BreakingImpulseThreshold = 999999999999999; c.SetLimit(0, 0, 150); c.SetLimit(1, 0, 100); c.SetLimit(2, 0, 0); c.SetLimit(3, 0, 0); c.SetLimit(4, 0, 0); c.SetLimit(5, 0, 0); //r.ApplyCentralImpulse(new Vector3(10, 10, 0)); //r.ApplyCentralForce(new Vector3(5, 5, 0)); world.AddConstraint(c); } } Console.WriteLine("Created"); }
/// <summary> /// Sets the limit. /// </summary> /// <param name="axis">The axis.</param> /// <param name="lo">The lo.</param> /// <param name="hi">The hi.</param> public void SetLimit(int axis, float lo, float hi) { _g6dofci.SetLimit(axis, lo, hi); }