/// <summary> /// Initializes a new instance of the RigidBody class. /// </summary> /// <param name="shape">The shape of the body.</param> /// <param name="isParticle">If set to true the body doesn't rotate. /// Also contacts are only solved for the linear motion part.</param> public RigidBody(Shape shape, BodyMaterial material, bool isParticle) { readOnlyArbiters = new ReadOnlyHashset <Arbiter>(arbiters); readOnlyConstraints = new ReadOnlyHashset <Constraint>(constraints); instanceCount++; instance = instanceCount; hashCode = CalculateHash(instance); this.Shape = shape; orientation = FPMatrix.Identity; if (!isParticle) { updatedHandler = new ShapeUpdatedHandler(ShapeUpdated); this.Shape.ShapeUpdated += updatedHandler; SetMassProperties(); } else { this.inertia = FPMatrix.Zero; this.invInertia = this.invInertiaWorld = FPMatrix.Zero; this.invOrientation = this.orientation = FPMatrix.Identity; inverseMass = FP.One; } AllowDeactivation = true; EnableSpeculativeContacts = false; this.isParticle = isParticle; Update(); }
/// <summary> /// Initializes a new instance of the RigidBody class. /// </summary> /// <param name="shape">The shape of the body.</param> public RigidBody(Shape shape, BodyMaterial material) : this(shape, material, false) { }
public MassPoint(Shape shape, SoftBody owner, BodyMaterial material) : base(shape, material, true) { this.SoftBody = owner; }