Example #1
0
 /// <summary>
 /// Constructor for a body. Uses default values.
 /// </summary>
 /// <param name="physics">The physics simulator that this body will be a part of.</param>
 public Body(PhysicsSimulator physics)
     : this(1, 1, 1, 10, .25f, physics)
 {
 }
Example #2
0
 /// <summary>
 /// Constructor for a body.
 /// </summary>
 /// <param name="width">The width of the shape.</param>
 /// <param name="height">The height of the shape.</param>
 /// <param name="depth">The depth of the shape.</param>
 /// <param name="mass">The mass of the body.</param>
 /// <param name="friction">The friction of the body.</param>
 /// <param name="physics">The physics simulator that this body will be a part of.</param>
 public Body(float width, float height, float depth, float mass, float friction, PhysicsSimulator physics)
 {
     Initialize(width, height, depth, mass, friction, physics);
 }
Example #3
0
 /// <summary>
 /// Initialize the body.
 /// </summary>
 /// <param name="width">The width of the shape.</param>
 /// <param name="height">The height of the shape.</param>
 /// <param name="depth">The depth of the shape.</param>
 /// <param name="mass">The mass of the body.</param>
 /// <param name="friction">The friction of the body.</param>
 /// <param name="physics">The physics simulator that this body will be a part of.</param>
 protected void Initialize(float width, float height, float depth, float mass, float friction, PhysicsSimulator physics)
 {
     // Initialize a couple of variables.
     _Shape = new Shape(width, height, depth);
     _IsStatic = false;
     _IsImmaterial = false;
     _MaxVelocity = 8;
     _Mass = mass;
     _Velocity = new Vector3(0, 0, 0);
     _FrictionCoefficient = friction;
     _AccelerationValue = 1;
     _Physics = physics;
     _Collisions = new HashSet<Body>();
 }