Exemplo n.º 1
0
        //物理反馈的数据不精确 待优化
        private bool CheckBoxInPhy(GamePlay.GWorld world, ref BoundingBox box, ref Vector3 pos, ref Quaternion rotation)//float dis, float offset
        {
            GamePlay.SceneGraph.GSceneGraph DefaultScene = world.DefaultScene;
            Bricks.PhysicsCore.CPhyScene    PhyScene     = DefaultScene.PhyScene;
            var shape = CEngine.Instance.PhyContext.CreateShapeBox(PhysicsCore.CPhyMaterial.DefaultPhyMaterial, box.GetSize().X, box.GetSize().Y, box.GetSize().Z);

            GamePlay.SceneGraph.VHitResult result = new GamePlay.SceneGraph.VHitResult();

            Matrix mat1 = Matrix.Transformation(Vector3.UnitXYZ, Quaternion.Identity, box.GetCenter());
            Matrix mat2 = Matrix.Transformation(Vector3.UnitXYZ, rotation, pos);
            Matrix mat3 = mat1 * mat2;

            Vector3    scale;
            Vector3    position;
            Quaternion rot;

            mat3.Decompose(out scale, out rot, out position);
            return(PhyScene.Overlap(shape, position, rot, ref result));
        }
Exemplo n.º 2
0
 public bool CreatePhysicsScene(Bricks.PhysicsCore.CPhySceneDesc desc)
 {
     mPhyScene           = CEngine.Instance.PhyContext.CreateScene(this.SceneId, desc);
     mPhyScene.GameScene = this;
     return(mPhyScene != null);
 }