コード例 #1
0
ファイル: BoxShape.cs プロジェクト: sandygk/System.Physics
        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
ファイル: Form1.cs プロジェクト: sandygk/System.Physics
 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
ファイル: BoxShape.cs プロジェクト: sandygk/System.Physics
 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;
 }