コード例 #1
0
        private bool QueryCallback(int proxyid)
        {
            Actor actor = _tree.GetUserData(proxyid);

            actor.Overlap = AABB.TestOverlap(ref _queryAABB, ref actor.AABB);
            return(true);
        }
コード例 #2
0
ファイル: DynamicTreeTest.cs プロジェクト: CrazyLiu00/GMap
        bool QueryCallback(int proxyid)
        {
            Actor actor = (Actor)_tree.GetUserData(proxyid);

            actor.overlap = AABB.TestOverlap(ref _queryAABB, ref actor.aabb);
            return(true);
        }
コード例 #3
0
        private bool QueryCallback(int proxyId)
        {
            var actor = (Actor)_tree.GetUserData(proxyId);

            actor.Overlap = CollisionUtils.TestOverlap(_queryAABB, actor.AABB);
            return(true);
        }
コード例 #4
0
    private long callBack(RayCastInput i, int node)
    {
        var proxy  = tree.GetUserData(node);
        var center = proxy.AABB.Center;
        var aabb   = new AABB(-proxy.AABB.Extents, proxy.AABB.Extents);
        var a      = i.Point1 - center;

        a = RotateReversePosi(a, proxy.Fixture.angle);
        var b = i.Point2 - center;

        b        = RotateReversePosi(b, proxy.Fixture.angle);
        i.Point1 = a;
        i.Point2 = b;
        RayCastOutput o;

        if (aabb.RayCast(out o, ref i))
        {
            //Debug.Log(o.Fraction.ToFloat());
            var hitPosi = i.Point1 + (i.Point2 - i.Point1) * o.Fraction;
            hitPosi = RotatePosi(hitPosi, proxy.Fixture.angle) + center;
            NewSphere(hitPosi.ToVector3(), "hit");
            //Debug.Log("hit something at " + hitPosi);
            return(FixedMath.One);
        }
        else
        {
            return(i.MaxFraction);
        }
    }
コード例 #5
0
        private bool ObbTestCallback(int id)
        {
            var f = PhysicsTree.GetUserData(id);

            f.AABB.DrawAABB(Color.red, 0, 0.01f);
            var hit = AABB.TestObb(f.AABB, _toTestAABB, f.Fixture.angle, _toTestAABBAngle);

            if (hit)
            {
                var hitPosi = (f.AABB.Center + _toTestAABB.Center) / 2;
                output.HitInfos[output.EndIndex] = new HitInfo()
                {
                    BodyType = f.BodyType,
                    Proxy    = f
                };
                output.EndIndex++;
            }
            return(true);
        }