public PhysxTriangleMesh(PhysxPhysicWorld PhysxPhysicWorld, IModelo model,Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
        {
            Microsoft.Xna.Framework.Vector3[] vertices = null;
            int[] indices = null;
            ExtractData(ref vertices, ref indices, model);                                    

            
            TriangleMeshDesc meshDesc = new TriangleMeshDesc();            
            Vector3[] points = new Vector3[vertices.Count()];
            for (int i = 0; i < vertices.Count(); i++)
			{
			    points[i] = vertices[i].AsPhysX();
			}            
            meshDesc.Points = points;            
            meshDesc.SetTriangles<int>(indices);
            //meshDesc.Triangles = indices;
            
            MemoryStream ms = new MemoryStream();
            if(PhysxPhysicWorld.Cooking.CookTriangleMesh(meshDesc,ms)==false)
            {
                PloobsEngine.Engine.Logger.ActiveLogger.LogMessage("Cant Cook Model",Engine.Logger.LogLevel.FatalError);
            }
            
            ms.Position = 0;
            TriangleMesh triangleMesh = PhysxPhysicWorld.Physix.CreateTriangleMesh(ms);
            
            staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
            TriangleMeshGeometry TriangleMeshGeometry = new TriangleMeshGeometry(triangleMesh,new MeshScale(scale.AsPhysX(),Quaternion.Identity));

            material = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
            aTriMeshShape = staticActor.CreateShape(TriangleMeshGeometry, material, localTransformation.AsPhysX());

            this.Scale = scale;
        }
 public PhysxPhysicObject(Scene scene, Geometry geometry, float mass, Matrix localTransformation, Matrix worldTransformation, Vector3 scale, MaterialDescription MaterialDescription)
 {            
     Scale = scale;
     rigidActor = scene.Physics.CreateRigidDynamic(worldTransformation.AsPhysX());            
     material = scene.Physics.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);            
     var boxShape = rigidActor.CreateShape(geometry, material, localTransformation.AsPhysX());                                                
     rigidActor.SetMassAndUpdateInertia(mass);                        
 }
        public PhysxPhysicObject(Scene scene, Geometry geometry, float mass, Matrix localTransformation, Matrix worldTransformation, Vector3 scale, MaterialDescription MaterialDescription)
        {
            Scale      = scale;
            rigidActor = scene.Physics.CreateRigidDynamic(worldTransformation.AsPhysX());
            material   = scene.Physics.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
            var boxShape = rigidActor.CreateShape(geometry, material, localTransformation.AsPhysX());

            rigidActor.SetMassAndUpdateInertia(mass);
        }
        public PhysxTriangleMesh(PhysxPhysicWorld PhysxPhysicWorld, FileStream FileStream, Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
        {
            TriangleMesh triangleMesh = PhysxPhysicWorld.Physix.CreateTriangleMesh(FileStream);

            staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
            TriangleMeshGeometry TriangleMeshGeometry = new TriangleMeshGeometry(triangleMesh, new MeshScale(scale.AsPhysX(), Quaternion.Identity));

            material      = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
            aTriMeshShape = staticActor.CreateShape(TriangleMeshGeometry, material, localTransformation.AsPhysX());

            this.Scale = scale;
        }
Пример #5
0
        public PyDynamic(PyType type, Scene.Entity3D ent)
        {
            Sent = ent;
            PhysicsManager.AddObj(this);
            Mat = PhysicsManager.py.CreateMaterial(0.7f, 0.7f, 0.1f);
            switch (type)
            {
            case PyType.Box:
                CreateBox(ent);
                break;

                break;
            }
        }
        public PhysxTriangleMesh(PhysxPhysicWorld PhysxPhysicWorld, IModelo model, Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
        {
            Microsoft.Xna.Framework.Vector3[] vertices = null;
            int[] indices = null;
            ExtractData(ref vertices, ref indices, model);


            TriangleMeshDesc meshDesc = new TriangleMeshDesc();

            Vector3[] points = new Vector3[vertices.Count()];
            for (int i = 0; i < vertices.Count(); i++)
            {
                points[i] = vertices[i].AsPhysX();
            }
            meshDesc.Points = points;
            meshDesc.SetTriangles <int>(indices);
            //meshDesc.Triangles = indices;

            MemoryStream ms = new MemoryStream();

            if (PhysxPhysicWorld.Cooking.CookTriangleMesh(meshDesc, ms) == false)
            {
                PloobsEngine.Engine.Logger.ActiveLogger.LogMessage("Cant Cook Model", Engine.Logger.LogLevel.FatalError);
            }

            ms.Position = 0;
            TriangleMesh triangleMesh = PhysxPhysicWorld.Physix.CreateTriangleMesh(ms);

            staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
            TriangleMeshGeometry TriangleMeshGeometry = new TriangleMeshGeometry(triangleMesh, new MeshScale(scale.AsPhysX(), Quaternion.Identity));

            material      = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
            aTriMeshShape = staticActor.CreateShape(TriangleMeshGeometry, material, localTransformation.AsPhysX());

            this.Scale = scale;
        }
Пример #7
0
 public PyStatic(Scene.Entity3D ent)
 {
     Mat = PhysicsManager.py.CreateMaterial(0.7f, 0.7f, 0.1f);
     CreateMesh(ent);
     PhysicsManager.AddObj(this);
 }
Пример #8
0
 public void SetMat()
 {
     Mat = PhysicsManager.py.CreateMaterial(0.7f, 0.7f, 0.1f);
 }
Пример #9
0
 public PhysxStaticActor(PhysxPhysicWorld PhysxPhysicWorld, Geometry geometry, Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
 {
     staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
     material    = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
     Shape aTriMeshShape = staticActor.CreateShape(geometry, material, localTransformation.AsPhysX());
 }
        public PhysxTriangleMesh(PhysxPhysicWorld PhysxPhysicWorld, FileStream FileStream, Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
        {
            TriangleMesh triangleMesh = PhysxPhysicWorld.Physix.CreateTriangleMesh(FileStream);

            staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
            TriangleMeshGeometry TriangleMeshGeometry = new TriangleMeshGeometry(triangleMesh, new MeshScale(scale.AsPhysX(), Quaternion.Identity));

            material = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
            aTriMeshShape = staticActor.CreateShape(TriangleMeshGeometry, material, localTransformation.AsPhysX());

            this.Scale = scale;
        }
 public PhysxStaticActor(PhysxPhysicWorld PhysxPhysicWorld ,Geometry geometry, Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
 {            
     staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
     material = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
     Shape aTriMeshShape = staticActor.CreateShape(geometry, material, localTransformation.AsPhysX());
 }