Example #1
0
        public virtual PxMaterial createMaterial(float staticFriction, float dynamicFriction, float restitution)
        {
            global::System.IntPtr cPtr = physxPINVOKE.PxPhysics_createMaterial(swigCPtr, staticFriction, dynamicFriction, restitution);
            PxMaterial            ret  = (cPtr == global::System.IntPtr.Zero) ? null : new PxMaterial(cPtr, false);

            return(ret);
        }
        public void AddShape(PxPhysics physics, Shapes type, PxMaterial material)
        {
            PxShape shape;
            bool    cdn = type == Shapes.Box;

            if (rigidbody == null)
            {
                var t      = Entity.Get <TransformComponent>().LocalMatrix;
                var Matrix = new PxMat44(new PxVec4(t.M11, t.M12, t.M13, t.M14), new PxVec4(t.M21, t.M22, t.M23, t.M24), new PxVec4(t.M31, t.M32, t.M33, t.M34), new PxVec4(t.M41, t.M42, t.M43, t.M44));
                rigidbody = physics.createRigidDynamic(new PxTransform(Matrix));
                if (cdn)
                {
                    shape = physics.createShape(new PxBoxGeometry(new PxVec3(1, 1, 1)), material, true);
                }
                else
                {
                    shape = physics.createShape(new PxCapsuleGeometry(1, 1), material, true);
                }
            }
            else
            {
                if (cdn)
                {
                    shape = physics.createShape(new PxBoxGeometry(new PxVec3(1, 1, 1)), material, true);
                }
                else
                {
                    shape = physics.createShape(new PxCapsuleGeometry(1, 1), material, true);
                }
            }
        }
Example #3
0
        public virtual PxMaterial getMaterialFromInternalFaceIndex(SWIGTYPE_p_uint32_t faceIndex)
        {
            global::System.IntPtr cPtr = physxPINVOKE.PxShape_getMaterialFromInternalFaceIndex(swigCPtr, SWIGTYPE_p_uint32_t.getCPtr(faceIndex));
            PxMaterial            ret  = (cPtr == global::System.IntPtr.Zero) ? null : new PxMaterial(cPtr, false);

            if (physxPINVOKE.SWIGPendingException.Pending)
            {
                throw physxPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #4
0
        public PxShape createShape(PxGeometry geometry, PxMaterial material, SWIGTYPE_p_physx__PxFlagsT_physx__PxShapeFlag__Enum_uint8_t_t shapeFlags)
        {
            global::System.IntPtr cPtr = physxPINVOKE.PxRigidActor_createShape__SWIG_2(swigCPtr, PxGeometry.getCPtr(geometry), PxMaterial.getCPtr(material), SWIGTYPE_p_physx__PxFlagsT_physx__PxShapeFlag__Enum_uint8_t_t.getCPtr(shapeFlags));
            PxShape ret = (cPtr == global::System.IntPtr.Zero) ? null : new PxShape(cPtr, false);

            if (physxPINVOKE.SWIGPendingException.Pending)
            {
                throw physxPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #5
0
        public PxShape createShape(PxGeometry geometry, PxMaterial material)
        {
            global::System.IntPtr cPtr = physxPINVOKE.PxRigidActor_createShape__SWIG_3(swigCPtr, PxGeometry.getCPtr(geometry), PxMaterial.getCPtr(material));
            PxShape ret = (cPtr == global::System.IntPtr.Zero) ? null : new PxShape(cPtr, false);

            if (physxPINVOKE.SWIGPendingException.Pending)
            {
                throw physxPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #6
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PxMaterial obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Example #7
0
 public void DeleteShapeFromEntity(Shapes type, Entity entity, PxMaterial material)
 {
     entity.Get <PhysXComponentBase>().AddShape(physics, type, material);
 }