예제 #1
0
    public void BodyArbiterIteratorFunc(cpArbiter arbiter, ref cpVect data)
    {
        cpVect n = cpVect.cpvneg(arbiter.GetNormal());

        if (n.y > ((cpVect)data).y)
        {
            data = n;
        }
    }
예제 #2
0
        public void SelectPlayerGroundNormal(cpArbiter arb, ref cpVect groundNormal)
        {
            cpVect n = cpVect.cpvneg(arb.GetNormal());

            if (n.y > groundNormal.y)
            {
                groundNormal = n;
            }
        }
예제 #3
0
        static bool preSolve(cpArbiter arb, cpSpace space, object o)
        {
            cpShape a, b;

            arb.GetShapes(out a, out b);

            OneWayPlatform platform = (OneWayPlatform)a.userData;            // (OneWayPlatform*)cpShapeGetUserData(a);

            if (cpVect.cpvdot(arb.GetNormal(), platform.n) < 0)
            {
                arb.Ignore();                // cpArbiterIgnore(arb);
                return(false);
            }

            return(true);
        }
예제 #4
0
        public void GenerateContactData()
        {
            if (_contactInfo == null)
            {
                return;
            }

            cpArbiter arb = (cpArbiter)_contactInfo;

            _preContactData = _contactData;
            _contactData    = new CCPhysicsContactData();

            for (int i = 0; i < _contactData.count && i < CCPhysicsContactData.POINT_MAX; ++i)
            {
                _contactData.points[i] = PhysicsHelper.cpVectToCCPoint(arb.GetPointA(i));
            }

            _contactData.normal = _contactData.count > 0 ? PhysicsHelper.cpVectToCCPoint(arb.GetNormal()) : CCPoint.Zero;
        }