예제 #1
0
        internal MotorJoint(MotorJointDef def) : base(def)
        {
            m_linearOffset  = def.linearOffset;
            m_angularOffset = def.angularOffset;

            m_linearImpulse.SetZero();
            m_angularImpulse = 0.0f;

            m_maxForce         = def.maxForce;
            m_maxTorque        = def.maxTorque;
            m_correctionFactor = def.correctionFactor;
        }
예제 #2
0
		public MotorJointTest()
		{
			Body ground = null;
			{
				BodyDef bd = new BodyDef();
				ground = m_world.CreateBody(bd);

				EdgeShape shape = new EdgeShape();
				shape.Set(new Vec2(-20.0f, 0.0f), new Vec2(20.0f, 0.0f));

				FixtureDef fd = new FixtureDef();
				fd.shape = shape;

				ground.CreateFixture(fd);
			}

			// Define motorized body
			{
				BodyDef bd = new BodyDef();
				bd.type = BodyType._dynamicBody;
				bd.Position.Set(0.0f, 8.0f);
				Body body = m_world.CreateBody(bd);

				PolygonShape shape = new PolygonShape();
				shape.SetAsBox(2.0f, 0.5f);

				FixtureDef fd = new FixtureDef();
				fd.shape = shape;
				fd.friction = 0.6f;
				fd.Density = 2.0f;
				body.CreateFixture(fd);

				MotorJointDef mjd = new MotorJointDef();
				mjd.Initialize(ground, body);
				mjd.maxForce = 1000.0f;
				mjd.maxTorque = 1000.0f;
				m_joint = (MotorJoint)m_world.CreateJoint(mjd);
			}

			m_go = false;
			m_time = 0.0f;
		}
예제 #3
0
		internal MotorJoint(MotorJointDef def): base(def)
		{
			m_linearOffset = def.linearOffset;
			m_angularOffset = def.angularOffset;

			m_linearImpulse.SetZero();
			m_angularImpulse = 0.0f;

			m_maxForce = def.maxForce;
			m_maxTorque = def.maxTorque;
			m_correctionFactor = def.correctionFactor;
		}