Example #1
0
 public SphereShape(RigidBody rigidBody, Matrix4x4 realParentPose, Material material, SphereShapeDescriptor descriptor)
 {
     var sphereShapeDescription = new SphereShapeDescription(descriptor.Radius)
                                      {Material = material._wrappedMaterial};
     _wrappedSphereShape =
         (StillDesign.PhysX.SphereShape)rigidBody.WrappedActor.CreateShape(sphereShapeDescription);
     SetRealParentPose(realParentPose);
     UserData = descriptor.UserData;
     if (rigidBody.HasDefaultShape)
     {
         rigidBody.WrappedActor.Shapes[0].Dispose();
         rigidBody.HasDefaultShape = false;
     }
 }
Example #2
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;
            }
        }
Example #3
0
        public PlaneShape(RigidBody rigidBody, Matrix4x4 realParentPose, Material material, PlaneShapeDescriptor descriptor)
        {
            var planeShapeDescription = new PlaneShapeDescription(descriptor.Normal.ToPhysX(), descriptor.DistanceFromOrigin) { Material = material._wrappedMaterial };
            _wrappedPlaneShape =
                (StillDesign.PhysX.PlaneShape)
                rigidBody.WrappedActor.CreateShape(planeShapeDescription);
            _normal = descriptor.Normal;
            _distanceFromOrigin = descriptor.DistanceFromOrigin;
            _pose = realParentPose;

            SetRealParentPose(realParentPose);


            UserData = descriptor.UserData;
            if (rigidBody.HasDefaultShape)
            {
                rigidBody.WrappedActor.Shapes[0].Dispose();
                rigidBody.HasDefaultShape = false;
            }
        }