private void CreateScene3() { var chainBoxes = new List <BoxObject>(); for (var i = 0; i < 25; i++) { var boxObject = new BoxObject(this, boxModel, Vector3.One, Matrix.Identity, new Vector3(i, 25 - i, 0)); if (i == 0) { boxObject.PhysicsBody.Immovable = true; } chainBoxes.Add(boxObject); } for (var i = 1; i < 25; i++) { var hingeJoint = new HingeJoint(); hingeJoint.Initialise(chainBoxes[i - 1].PhysicsBody, chainBoxes[i].PhysicsBody, Vector3.Backward, new Vector3(0.5f, -0.5f, 0.0f), 0.5f, 90.0f, 90.0f, 0.0f, 0.2f); hingeJoint.EnableController(); hingeJoint.EnableHinge(); } foreach (var obj in chainBoxes) { Components.Add(obj); } }
public XHingeJoint(ref XMain X, XActor actor1, XActor actor2, Vector3 HingeAxis, Vector3 Offset, float Width, float ForwardMax, float BackWardMax, float Sideways, float Damping) : base(ref X) { hinge = new HingeJoint(); hinge.Initialise(actor1.PhysicsObject.PhysicsBody, actor2.PhysicsObject.PhysicsBody, HingeAxis, Offset, Width / 2, ForwardMax, BackWardMax, Sideways, Damping); hinge.EnableController(); hinge.EnableHinge(); }