Example #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();
        }
Example #2
0
 public CollisionIsland()
 {
     this.readOnlyBodies      = new ReadOnlyHashset <RigidBody>(this.bodies);
     this.readOnlyArbiter     = new ReadOnlyHashset <Arbiter>(this.arbiter);
     this.readOnlyConstraints = new ReadOnlyHashset <Constraint>(this.constraints);
 }