Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
Наследование: JointDef
Пример #1
0
        public PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def)
            : base(argWorld, def)
        {
            m_localAnchorA = new Vec2(def.localAnchorA);
            m_localAnchorB = new Vec2(def.localAnchorB);
            m_localXAxisA = new Vec2(def.localAxisA);
            m_localXAxisA.normalize();
            m_localYAxisA = new Vec2();
            Vec2.crossToOutUnsafe(1f, m_localXAxisA, m_localYAxisA);
            m_referenceAngle = def.referenceAngle;

            m_impulse = new Vec3();
            m_motorMass = 0.0f;
            m_motorImpulse = 0.0f;

            m_lowerTranslation = def.lowerTranslation;
            m_upperTranslation = def.upperTranslation;
            m_maxMotorForce = def.maxMotorForce;
            m_motorSpeed = def.motorSpeed;
            m_enableLimit = def.enableLimit;
            m_enableMotor = def.enableMotor;
            m_limitState = LimitState.INACTIVE;

            m_K = new Mat33();
            m_axis = new Vec2();
            m_perp = new Vec2();
        }
Пример #2
0
        public PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def)
            : base(argWorld, def)
        {
            LocalAnchorA = new Vec2(def.LocalAnchorA);
            LocalAnchorB = new Vec2(def.LocalAnchorB);
            LocalXAxisA = new Vec2(def.LocalAxisA);
            LocalXAxisA.Normalize();
            LocalYAxisA = new Vec2();
            Vec2.CrossToOutUnsafe(1f, LocalXAxisA, LocalYAxisA);
            ReferenceAngle = def.ReferenceAngle;

            Impulse = new Vec3();
            MotorMass = 0.0f;
            MotorImpulse = 0.0f;

            LowerTranslation = def.LowerTranslation;
            UpperTranslation = def.UpperTranslation;
            m_maxMotorForce = def.MaxMotorForce;
            m_motorSpeed = def.MotorSpeed;
            m_limitEnabled = def.EnableLimit;
            m_motorEnabled = def.EnableMotor;
            LimitState = LimitState.Inactive;

            K = new Mat33();
            Axis = new Vec2();
            Perp = new Vec2();
        }