コード例 #1
0
ファイル: PhysUtil.cs プロジェクト: NoahStarfinder/My-Halcyon
        public static OpenSim.Region.Physics.Manager.Pose MatrixToPose(PhysX.Math.Matrix matrix)
        {
            OpenSim.Region.Physics.Manager.Pose pose;
            pose.Position = DecomposeToPosition(matrix);
            pose.Rotation = DecomposeToRotation(matrix);

            return(pose);
        }
コード例 #2
0
 public static Matrix AsXNA(this PhysX.Math.Matrix m)
 {
     return(new Matrix
            (
                m.M11, m.M12, m.M13, m.M14,
                m.M21, m.M22, m.M23, m.M24,
                m.M31, m.M32, m.M33, m.M34,
                m.M41, m.M42, m.M43, m.M44
            ));
 }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
        internal List <PhysX.Shape> AssignToActor(PhysX.RigidActor actor, PhysX.Material material, PhysX.Math.Matrix localPose, bool physical)
        {
            switch (_shapeType)
            {
            case ShapeType.PrimitiveBox:
            case ShapeType.PrimitiveSphere:
                return(new List <PhysX.Shape> {
                    CreatePrimitiveShape(actor, material, ref localPose, physical)
                });

            case ShapeType.TriMesh:
                return(new List <PhysX.Shape> {
                    CreateTrimeshShape(actor, material, ref localPose)
                });

            case ShapeType.DecomposedConvexHulls:
            case ShapeType.SingleConvex:
                return(this.AssignHullsToActor(actor, material, localPose, physical));

            case ShapeType.Null:
                return(new List <PhysX.Shape>(0));

            default:
                throw new InvalidOperationException("Can not assign shape to actor: shapeType is missing or invalid");
            }
        }
コード例 #7
0
ファイル: PhysUtil.cs プロジェクト: NoahStarfinder/My-Halcyon
 public static OpenMetaverse.Quaternion DecomposeToRotation(PhysX.Math.Matrix matrix)
 {
     PhysX.Math.Quaternion physxRot = PhysX.Math.Quaternion.RotationMatrix(matrix);
     return(new OpenMetaverse.Quaternion(physxRot.X, physxRot.Y, physxRot.Z, physxRot.W));
 }
コード例 #8
0
ファイル: PhysUtil.cs プロジェクト: NoahStarfinder/My-Halcyon
 public static OpenMetaverse.Vector3 DecomposeToPosition(PhysX.Math.Matrix matrix)
 {
     return(new OpenMetaverse.Vector3(matrix.M41, matrix.M42, matrix.M43));
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: NoahStarfinder/My-Halcyon
 public static PhysX.Math.Vector3 DecomposeToPosition(PhysX.Math.Matrix matrix)
 {
     return(new PhysX.Math.Vector3(matrix.M41, matrix.M42, matrix.M43));
 }