Esempio n. 1
0
        // Cache here per time step to reduce cache misses.
        // Vec2 m_localCenterA, m_localCenterB;
        // double m_invMassA, m_invIA;
        // double m_invMassB, m_invIB;

        public Joint(IWorldPool worldPool, JointDef def)
        {
            pool               = worldPool;
            m_type             = def.type;
            m_prev             = null;
            m_next             = null;
            m_bodyA            = def.bodyA;
            m_bodyB            = def.bodyB;
            m_collideConnected = def.collideConnected;
            m_islandFlag       = false;
            m_userData         = def.userData;

            m_edgeA       = new JointEdge();
            m_edgeA.joint = null;
            m_edgeA.other = null;
            m_edgeA.prev  = null;
            m_edgeA.next  = null;

            m_edgeB       = new JointEdge();
            m_edgeB.joint = null;
            m_edgeB.other = null;
            m_edgeB.prev  = null;
            m_edgeB.next  = null;

            // m_localCenterA = new Vec2();
            // m_localCenterB = new Vec2();
        }
Esempio n. 2
0
        public static Joint create(World world, JointDef def)
        {
            // Joint joint = null;
            switch (def.type)
            {
            case JointType.MOUSE:
                return(new MouseJoint(world.getPool(), (MouseJointDef)def));

            case JointType.DISTANCE:
                return(new DistanceJoint(world.getPool(), (DistanceJointDef)def));

            case JointType.PRISMATIC:
                return(new PrismaticJoint(world.getPool(), (PrismaticJointDef)def));

            case JointType.REVOLUTE:
                return(new RevoluteJoint(world.getPool(), (RevoluteJointDef)def));

            case JointType.WELD:
                return(new WeldJoint(world.getPool(), (WeldJointDef)def));

            case JointType.FRICTION:
                return(new FrictionJoint(world.getPool(), (FrictionJointDef)def));

            case JointType.WHEEL:
                return(new WheelJoint(world.getPool(), (WheelJointDef)def));

            case JointType.GEAR:
                return(new GearJoint(world.getPool(), (GearJointDef)def));

            case JointType.PULLEY:
                return(new PulleyJoint(world.getPool(), (PulleyJointDef)def));

            case JointType.CONSTANT_VOLUME:
                return(new ConstantVolumeJoint(world, (ConstantVolumeJointDef)def));

            case JointType.ROPE:
                return(new RopeJoint(world.getPool(), (RopeJointDef)def));

            case JointType.UNKNOWN:
            default:
                return(null);
            }
        }