Esempio n. 1
0
		public static void SetBox(Vector3 p, Vector3 n) {
			if (box == null) {
				box = new BEPUphysics.Entities.Prefabs.Box(BEPUutilities.Vector3.Zero, 1, 1, 1, 50);
				box.BecomeDynamic(50);
				World.Add(box);
			}
			box.Position = new BEPUutilities.Vector3(p.X, p.Y, p.Z);
			box.Orientation = BEPUutilities.Quaternion.Identity;
			box.LinearVelocity = new BEPUutilities.Vector3(n.X, n.Y, n.Z);
		}
Esempio n. 2
0
 public static void SetBox(Vector3 p, Vector3 n)
 {
     if (box == null)
     {
         box = new BEPUphysics.Entities.Prefabs.Box(BEPUutilities.Vector3.Zero, 1, 1, 1, 50);
         box.BecomeDynamic(50);
         World.Add(box);
     }
     box.Position       = new BEPUutilities.Vector3(p.X, p.Y, p.Z);
     box.Orientation    = BEPUutilities.Quaternion.Identity;
     box.LinearVelocity = new BEPUutilities.Vector3(n.X, n.Y, n.Z);
 }
Esempio n. 3
0
        public RigidBody(Shape shape)
        {
            entity     = new BEPUphysics.Entities.Entity(shape.shape);
            this.shape = shape;
            UpdateMassProperties(shape.Mass);

            //Helper.Check(shape.massDistribution);

            entity.BecomeDynamic(Mass, shape.massDistribution);

            //Check();

            material = new Material(entity.Material);
        }
Esempio n. 4
0
 private void UpdateMassProperties(float mass)
 {
     //Check();
     this.mass = mass;
     if (mass == 0.0f)
     {
         mass = 1.0f;
     }
     if (mass <= 0 || float.IsNaN(mass) || float.IsInfinity(mass))
     {
         entity.BecomeKinematic();
     }
     else
     {
         Matrix3X3 inertiaTensor;
         Matrix3X3.Multiply(
             ref shape.massDistribution,
             mass * BEPUphysics.CollisionShapes.ConvexShapes.InertiaHelper.InertiaTensorScale,
             out inertiaTensor
             );
         entity.BecomeDynamic(mass, inertiaTensor);
     }
     //Check();
 }