Exemple #1
0
        public RigidBody(Shape shape, BodyMaterial material, bool isParticle)
        {
            this.readOnlyArbiters    = new ReadOnlyHashset <Arbiter>(this.arbiters);
            this.readOnlyConstraints = new ReadOnlyHashset <Constraint>(this.constraints);
            RigidBody.instanceCount++;
            this.instance    = RigidBody.instanceCount;
            this.hashCode    = this.CalculateHash(this.instance);
            this.Shape       = shape;
            this.orientation = TSMatrix.Identity;
            bool flag = !isParticle;

            if (flag)
            {
                this.updatedHandler      = new ShapeUpdatedHandler(this.ShapeUpdated);
                this.Shape.ShapeUpdated += this.updatedHandler;
                this.SetMassProperties();
            }
            else
            {
                this.inertia        = TSMatrix.Zero;
                this.invInertia     = (this.invInertiaWorld = TSMatrix.Zero);
                this.invOrientation = (this.orientation = TSMatrix.Identity);
                this.inverseMass    = FP.One;
            }
            this.material                  = material;
            this.AllowDeactivation         = true;
            this.EnableSpeculativeContacts = false;
            this.isParticle                = isParticle;
            this.Update();
        }
Exemple #2
0
 public MassPoint(Shape shape, SoftBody owner, BodyMaterial material) : base(shape, material, true)
 {
     this.SoftBody = owner;
 }
Exemple #3
0
 public RigidBody(Shape shape, BodyMaterial material) : this(shape, material, false)
 {
 }