예제 #1
0
        public BoxShape(RigidBody rigidBody, Matrix4x4 realParentPose, Material material, BoxShapeDescriptor descriptor)
        {
            var boxShapeDescription = new BoxShapeDescription(descriptor.WidthX, descriptor.WidthY, descriptor.WidthZ)
                                          {
                                              Material = material._wrappedMaterial
                                          };

            _wrappedBoxShape =
                (StillDesign.PhysX.BoxShape)
                rigidBody.WrappedActor.CreateShape(boxShapeDescription);
            SetRealParentPose(realParentPose);
            UserData = descriptor.UserData;
            if (rigidBody.HasDefaultShape)
            {
                rigidBody.WrappedActor.Shapes[0].Dispose();
                rigidBody.HasDefaultShape = false;
            }
        }
예제 #2
0
 private void CreateTower(UniformMaterial material, BoxShapeDescriptor descriptor, int xCount, int yCount, int zCount, float xSpace, float ySpace, float zSpace, float xOffset, float yOffset, float zOffset)
 {
     for (int x = 0; x < xCount; x++)
         for (int y = 0; y < yCount; y++)
             for (int z = 0; z < zCount; z++)
             {
                 var box = new RigidBody
                               {
                                   MotionType = DigitalRune.Physics.MotionType.Dynamic,
                                   Pose = new Pose(new Vector3F(xOffset + x * xSpace - ((xCount - 1) * xSpace / 2),
                                                                yOffset + y * ySpace - ((yCount - 1) * ySpace / 2),
                                                                zOffset + z * zSpace - ((zCount - 1) * zSpace / 2))),
                                   Shape = new BoxShape(descriptor.WidthX, descriptor.WidthY, descriptor.WidthZ),
                                   Material = material,
                                   UserData = _boxModel
                               };
                 _simulation.RigidBodies.Add(box);
             }
 }
예제 #3
0
 public static IBoxShape CreateBox(this IFactory<IShape> factory,
                                             BoxShapeDescriptor descriptor)
 {
     return factory.Create<IBoxShape, BoxShapeDescriptor>(descriptor);
 }
예제 #4
0
 public BoxShape(BoxShapeDescriptor descriptor)
 {
     WrappedBoxShape = new global::DigitalRune.Geometry.Shapes.BoxShape(descriptor.WidthX, descriptor.WidthY, descriptor.WidthZ);
     UserData = descriptor.UserData;
 }
예제 #5
0
 public DefaultBoxShape(BoxShapeDescriptor descriptor)
 {
     Descriptor = descriptor;
 }