当前位置: 首页>>代码示例>>C#>>正文


C# Vector3.AsPhysX方法代码示例

本文整理汇总了C#中Vector3.AsPhysX方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.AsPhysX方法的具体用法?C# Vector3.AsPhysX怎么用?C# Vector3.AsPhysX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector3的用法示例。


在下文中一共展示了Vector3.AsPhysX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PhysxPhysicWorld

        public PhysxPhysicWorld(Vector3 gravity, bool connectToRemoteDebugger = false)
        {
            physix = new PhysX.Physics(new ErrorCallbackImp(), true);            
            
            var sceneDesc = new SceneDesc()
            {
                Gravity = gravity.AsPhysX()                
            };
                        
            scene = physix.CreateScene(sceneDesc);
                                    
            this.scene.SetVisualizationParameter(VisualizationParameter.Scale, 1.0f);
            this.scene.SetVisualizationParameter(VisualizationParameter.CollisionShapes, true);
            this.scene.SetVisualizationParameter(VisualizationParameter.JointLocalFrames, true);
            this.scene.SetVisualizationParameter(VisualizationParameter.JointLimits, true);
            this.scene.SetVisualizationParameter(VisualizationParameter.ParticleSystemPosition, true);
            this.scene.SetVisualizationParameter(VisualizationParameter.ActorAxes, true);            

            // Connect to the remote debugger if it's there            
            if (connectToRemoteDebugger)
            {
                physix.ConnectToRemoteDebugger("localhost");
            }
            
            objs = new List<IPhysicObject>();
            ctns = new List<IPhysicConstraint>();

            cooking = physix.CreateCooking();

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:30,代码来源:PhysxPhysicWorld.cs

示例2: PhysxCapsuleCharacterObject

 public PhysxCapsuleCharacterObject(CapsuleControllerDescription CapsuleControllerDescription,Vector3 position, Matrix rotation,Vector3 scale)
 {
     this.scale = scale;
     this.CapsuleControllerDescription = CapsuleControllerDescription;
     this.CapsuleControllerDescription.Position = position.AsPhysX();
     CapsuleControllerDescription.Height *= scale.Y;
     CapsuleControllerDescription.Radius *= scale.X;
     this.rotation = rotation;
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:9,代码来源:PhysxCapsuleCharacterObject.cs

示例3: PhysxBoxCharacterObject

 public PhysxBoxCharacterObject(BoxControllerDescription BoxControllerDescription, Vector3 position, Matrix rotation, Vector3 scale)
 {
     this.scale = scale;
     this.BoxControllerDescription = BoxControllerDescription;
     this.BoxControllerDescription.Position = position.AsPhysX();
     StillDesign.PhysX.MathPrimitives.Vector3 vec = BoxControllerDescription.Size;
     vec.X *= scale.X;
     vec.Y *= scale.Y;
     vec.Z *= scale.Z;
     BoxControllerDescription.Size = vec;
     this.rotation = rotation;
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:12,代码来源:PhysxBoxCharacterObject.cs

示例4: LoadContent

        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld;

            base.LoadContent(GraphicInfo, factory, contentManager);            

            int w = 25;
            int h = 25;

            float hw = w / 2.0f;
            float hh = h / 2.0f;

            Vector3 p = new Vector3(0, 20, 0);
            

            var grid = VertexGrid.CreateGrid(w, h);
            
            ClothModel ClothModel = new PloobsEngine.Modelo.ClothModel(factory, PhysxPhysicWorld,
                new ClothMeshDescription(), grid.Points,grid.TextCoords,grid.Indices, "Textures//meiofio");

            var clothDesc = new ClothDescription()
            {
                Friction = 0.5f,
                ClothMesh = ClothModel.ClothMesh,
                Flags = ClothFlag.Gravity | ClothFlag.Bending | ClothFlag.CollisionTwoway | ClothFlag.Visualization ,
                Thickness = 0.2f,                
            };            
            
            clothDesc.MeshData.AllocatePositions<Vector3>(grid.Points.Length );
            clothDesc.MeshData.AllocateIndices<int>(grid.Indices.Length );
            clothDesc.MeshData.AllocateNormals<Vector3>(grid.Points.Length );

            clothDesc.MeshData.MaximumVertices = grid.Points.Length ;
            clothDesc.MeshData.MaximumIndices = grid.Indices.Length ;

            clothDesc.MeshData.NumberOfVertices = grid.Points.Length ;
            clothDesc.MeshData.NumberOfIndices = grid.Indices.Length ;            
            
            PhysxClothObject PhysxClothObject = new PloobsEngine.Physics.PhysxClothObject(clothDesc,
                                                Matrix.CreateTranslation(-hw, 0, -hh) * Matrix.CreateTranslation(p));
            ForwardXNABasicShader ForwardXNABasicShader = new PloobsEngine.Material.ForwardXNABasicShader();
            ClothMaterial ClothMaterial = new ClothMaterial(ForwardXNABasicShader);
            IObject IObject = new PloobsEngine.SceneControl.IObject(ClothMaterial, ClothModel, PhysxClothObject);
            
            World.AddObject(IObject);



            // Four corner boxes to hold it in place
            var positions = new[]
			{
				new StillDesign.PhysX.MathPrimitives.Vector3(0, 0, -hh), // Back
				new StillDesign.PhysX.MathPrimitives.Vector3(0, 0, hh), // Front
				new StillDesign.PhysX.MathPrimitives.Vector3(-hw, 0, 0), // Left
				new StillDesign.PhysX.MathPrimitives.Vector3(hw, 0, 0), // Right
			};

            var sizes = new[]
			{
				new StillDesign.PhysX.MathPrimitives.Vector3(w, 1, 1), // Back
				new StillDesign.PhysX.MathPrimitives.Vector3(w, 1, 1), // Front
				new StillDesign.PhysX.MathPrimitives.Vector3(1, 1, h), // Left
				new StillDesign.PhysX.MathPrimitives.Vector3(1, 1, h), //Right
			};

            ///pra preender
            for (int i = 0; i < 2; i++)
            {
                var actorDesc = new ActorDescription()
                {
                    GlobalPose = StillDesign.PhysX.MathPrimitives.Matrix.Translation(positions[i] + p.AsPhysX()),
                    Shapes = { new BoxShapeDescription(sizes[i]) }
                };

                var actor = PhysxPhysicWorld.Scene.CreateActor(actorDesc);


                PhysxClothObject.Cloth.AttachToShape(actor.Shapes.First(), (ClothAttachmentFlag)0);                
            }
                        
            BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory);
            this.AttachCleanUpAble(BallThrowBullet);
            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:84,代码来源:BasicCloth28Screen.cs

示例5: GetPhysicsObjectsInRange

 public override void GetPhysicsObjectsInRange(Vector3 position, float distance, CullerConditionAvaliator<IPhysicObject, SceneControl.IObject> CullerAvaliator, List<IPhysicObject> resp)
 {
     SphereGeometry SphereGeometry = new PhysX.SphereGeometry(distance);
     foreach (var item in scene.OverlapMultiple(SphereGeometry, PhysX.Math.Matrix.Translation(position.AsPhysX())))
     {
         if (item.UserData is IPhysicObject)
         {
             IPhysicObject IPhysicObject = item.UserData as IPhysicObject;
             if (CullerAvaliator(IPhysicObject, IPhysicObject.ObjectOwner))
             {
                 resp.Add(IPhysicObject);
             }
         }
     }
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:15,代码来源:PhysxPhysicWorld.cs

示例6: ApplyImpulse

 public override void ApplyImpulse(Vector3 position, Vector3 force)
 {
     Actor.AddForceAtLocalPosition(force.AsPhysX(), position.AsPhysX());
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:4,代码来源:PhysxPhysicObject.cs


注:本文中的Vector3.AsPhysX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。