예제 #1
0
        private PhysX.Shape CreateTrimeshShape(PhysX.RigidActor actor, PhysX.Material material, ref PhysX.Math.Matrix localPose)
        {
            PhysX.Shape shape = actor.CreateShape(_triMesh, material, localPose);
            shape.RestOffset = REST_OFFSET;

            return(shape);
        }
예제 #2
0
        private void GenerateActorsFromTrimesh(PhysX.TriangleMeshGeometry triangleMeshShapeDesc, out PhysX.RigidActor hfActor, out PhysX.Shape shape)
        {
            //PhysX.Math.Matrix.RotationYawPitchRoll(0f, (float)Math.PI / 2, 0f) * PhysX.Math.Matrix.Translation(0f, 0f, 0f)

            //PhysX.RigidDynamic dynActor = _scene.Physics.CreateRigidDynamic();
            //dynActor.Flags |= PhysX.RigidDynamicFlags.Kinematic;
            //hfActor = dynActor;

            hfActor = _scene.Physics.CreateRigidStatic();

            shape = hfActor.CreateShape(triangleMeshShapeDesc, Material.GROUND.PhyMaterial);
        }
예제 #3
0
        private PhysX.Shape CreatePrimitiveShape(PhysX.RigidActor actor, PhysX.Material material, ref PhysX.Math.Matrix localPose,
                                                 bool physical)
        {
            PhysX.Shape shape = actor.CreateShape(_primitiveGeom, material, localPose);
            shape.RestOffset = REST_OFFSET;

            if (physical && Settings.Instance.UseCCD)
            {
                //enable CCD
                shape.Flags |= PhysX.ShapeFlag.UseSweptBounds;
            }

            return(shape);
        }
예제 #4
0
        private List <PhysX.Shape> AssignHullsToActor(PhysX.RigidActor actor, PhysX.Material material, PhysX.Math.Matrix localPose,
                                                      bool physical)
        {
            List <PhysX.Shape> hulls = new List <PhysX.Shape>();

            foreach (PhysX.ConvexMeshGeometry geom in _convexHulls)
            {
                PhysX.Shape shape = actor.CreateShape(geom, material, localPose);
                shape.RestOffset = REST_OFFSET;

                if (physical && Settings.Instance.UseCCD)
                {
                    //enable CCD
                    shape.Flags |= PhysX.ShapeFlag.UseSweptBounds;
                }

                hulls.Add(shape);
            }

            return(hulls);
        }