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


C# Scene.GetPhysicsEngine方法代码示例

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


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

示例1: OnAdd

 public override void OnAdd(Scene scene)
 {
     base.OnAdd(scene);
     if (false == true && mesh.GetCollisionMesh() != null)
     {
         Matrix currOrientation = Transformation.GetTransform();
         currOrientation.Translation = Vector3.Zero;
         Vector3 currPosition = Transformation.GetPosition();
         collisionTransform = new JigLibX.Math.Transform(currPosition, currOrientation);
         collision = new CollisionSkin(null);
         collision.AddPrimitive(mesh.GetCollisionMesh(), (int)MaterialTable.MaterialID.NotBouncyRough);
         scene.GetPhysicsEngine().CollisionSystem.AddCollisionSkin(collision);
         collision.SetNewTransform(ref collisionTransform);
     }
 }
开发者ID:MattVitelli,项目名称:IslandAdventure,代码行数:15,代码来源:Model.cs

示例2: OnAdd

        public override void OnAdd(Scene scene)
        {
            base.OnAdd(scene);

            scene.AddActor(this);

            PhysicsSystem world = scene.GetPhysicsEngine();

            Vector3 pos = Vector3.Up * 256 + 15*(new Vector3((float)RandomHelper.RandomGen.NextDouble(), (float)RandomHelper.RandomGen.NextDouble(), (float)RandomHelper.RandomGen.NextDouble())*2-Vector3.One);
            //pos.X += (scene.MainTerrain as TerrainHeightmap).GetWidth()*0.5f;
            //pos.Z += (scene.MainTerrain as TerrainHeightmap).GetDepth() * 0.5f;
            Vector3 normal = Vector3.Up;
            //scene.MainTerrain.GenerateRandomTransform(RandomHelper.RandomGen, out pos, out normal);
            //pos = pos + Vector3.Up * 5;

            body = new CharacterBody();
            collision = new CollisionSkin(body);

            standCapsule = new Capsule(Vector3.Zero, Matrix.CreateRotationX(MathHelper.PiOver2), 1.0f, 1.778f);
            crouchCapsule = new Capsule(Vector3.Zero, Matrix.CreateRotationX(MathHelper.PiOver2), 1.0f, 1.0f);
            SetupPosture(false);
            collision.AddPrimitive(standCapsule, (int)MaterialTable.MaterialID.NormalRough);
            body.CollisionSkin = collision;
            Vector3 com = PhysicsHelper.SetMass(75.0f, body, collision);

            body.MoveTo(pos + com, Matrix.Identity);
            collision.ApplyLocalTransform(new JigLibX.Math.Transform(-com, Matrix.Identity));

            body.SetBodyInvInertia(0.0f, 0.0f, 0.0f);

            body.AllowFreezing = false;
            body.EnableBody();
            Transformation = new Transform(body);

            ResetState();
        }
开发者ID:MattVitelli,项目名称:IslandAdventure,代码行数:36,代码来源:Actor.cs


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