Exemplo n.º 1
0
        public Actor.GActor PickActorWithFilter(out VHitResult hitResult, ref Bricks.PhysicsCore.PhyQueryFilterData queryFilterData, Graphics.CGfxCamera camera, int x, int y, float length = 1000.0f)
        {
            if (camera == null)
            {
                camera = CEngine.Instance.GameInstance?.GameCamera;
            }
            if (camera == null)
            {
                hitResult = VHitResult.Default;
                return(null);
            }
            var pickDir = new Vector3();

            if (camera.GetPickRay(ref pickDir, x, y, 0, 0) == false)
            {
                hitResult = VHitResult.Default;
                return(null);
            }
            var start = camera.CameraData.Position;
            var end   = camera.CameraData.Position + pickDir * length;
            var tmp   = VHitResult.Default;

            if (this.LineCheckWithFilter(ref start, ref end, ref queryFilterData, ref tmp) == false)
            {
                hitResult = VHitResult.Default;
                return(null);
            }
            hitResult = tmp;
            Actor.GActor outActor = null;
            GetHitActorByPhysics(ref hitResult, ref outActor);

            return(outActor);
        }
Exemplo n.º 2
0
        partial void LineCheckByPhysics(ref Vector3 start, ref Vector3 end, ref VHitResult rst, ref bool isChecked)
        {
            isChecked = false;
            if (mPhyScene == null)
            {
                return;
            }
            var dir  = end - start;
            var dist = dir.Length();

            dir       = dir / dist;
            isChecked = mPhyScene.Raycast(ref start, ref dir, dist, ref rst);
        }
Exemplo n.º 3
0
        partial void LineCheckWithFilterByPhysics(ref Vector3 start, ref Vector3 end, ref Bricks.PhysicsCore.PhyQueryFilterData queryFilterData, ref VHitResult rst, ref bool isChecked)
        {
            isChecked = false;
            if (mPhyScene == null)
            {
                return;
            }
            var dir  = end - start;
            var dist = dir.Length();

            dir       = dir / dist;
            isChecked = mPhyScene.RaycastWithFilter(ref start, ref dir, dist, ref queryFilterData, ref rst);
        }