/// <summary> Create a named body /// /// </summary> /// <param name="name">The name to assign to the body /// </param> /// <param name="shape">The shape describing this body /// </param> /// <param name="m">The mass of the body /// </param> protected internal Body(System.String name, Shape shape, float m) { this.name = name; id = NEXT_ID++; position.Reconfigure(0.0f, 0.0f); lastPosition.Reconfigure(0.0f, 0.0f); rotation = 0.0f; velocity.Reconfigure(0.0f, 0.0f); angularVelocity = 0.0f; force.Reconfigure(0.0f, 0.0f); torque = 0.0f; surfaceFriction = 0.2f; //Size.set(1.0f, 1.0f); mass = INFINITE_MASS; invMass = 0.0f; I = INFINITE_MASS; invI = 0.0f; originalMass = m; Reconfigure(shape, m); }
/// <summary> Create a new un-named body /// /// </summary> /// <param name="shape">The shape describing this body /// </param> /// <param name="m">The mass of the body /// </param> protected internal Body(Shape shape, float m) : this("UnnamedBody", shape, m) { }
/// <summary> Reconfigure the body /// /// </summary> /// <param name="shape">The shape describing this body /// </param> /// <param name="m">The mass of the body /// </param> public virtual void Reconfigure(Shape shape, float m) { position.Reconfigure(0.0f, 0.0f); lastPosition.Reconfigure(0.0f, 0.0f); rotation = 0.0f; velocity.Reconfigure(0.0f, 0.0f); angularVelocity = 0.0f; force.Reconfigure(0.0f, 0.0f); torque = 0.0f; surfaceFriction = 0.2f; this.shape = shape; SetMass(m); }
/// <summary> Constructs an exception in case there is no collider /// for a specific combination of two shapes. /// /// </summary> /// <param name="shapeA">First shape /// </param> /// <param name="shapeB">Second shape /// </param> public ColliderUnavailableException(Shape shapeA, Shape shapeB) : base("No collider available for shapes of type " + shapeA.GetType().FullName + " and " + shapeB.GetType().FullName) { }
/// <summary> Create a static body /// /// </summary> /// <param name="name">The name to assign to the body /// </param> /// <param name="shape">The shape representing this body /// </param> public StaticBody(System.String name, Shape shape) : base(name, shape, Body.INFINITE_MASS) { }
/// <summary> Create a static body /// /// </summary> /// <param name="shape">The shape representing this body /// </param> public StaticBody(Shape shape) : base(shape, Body.INFINITE_MASS) { }