[Opal-commits] opal/samples/src CarObject.cpp,1.20,1.21
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-02-23 04:56:58
|
Update of /cvsroot/opal/opal/samples/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27467/samples/src Modified Files: CarObject.cpp Log Message: added Solid init function; fixed sample apps Index: CarObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/CarObject.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CarObject.cpp 22 Feb 2005 19:46:26 -0000 1.20 --- CarObject.cpp 23 Feb 2005 04:56:48 -0000 1.21 *************** *** 53,60 **** // Setup a JointData object to reuse for several Joints. ! opal::JointData jd; ! jd.solid0 = mBody; ! jd.axis[0] = suspensionAxis; ! jd.axis[1] = wheelAxis; // Setup a SphereData object to reuse for the wheels. --- 53,60 ---- // Setup a JointData object to reuse for several Joints. ! opal::JointData jointData; ! jointData.solid0 = mBody; ! jointData.axis[0] = suspensionAxis; ! jointData.axis[1] = wheelAxis; // Setup a SphereData object to reuse for the wheels. *************** *** 72,79 **** // Add front left Joint. mFLJoint = sim->createJoint(); ! jd.type = opal::HINGE_2_JOINT; ! jd.solid1 = mFLWheel; ! jd.anchor = M.getPosition(); ! mFLJoint->init(jd); // Add front right wheel Solid. --- 72,79 ---- // Add front left Joint. mFLJoint = sim->createJoint(); ! jointData.setType(opal::HINGE_2_JOINT); ! jointData.solid1 = mFLWheel; ! jointData.anchor = M.getPosition(); ! mFLJoint->init(jointData); // Add front right wheel Solid. *************** *** 86,93 **** // Add front right Joint. mFRJoint = sim->createJoint(); ! jd.type = opal::HINGE_2_JOINT; ! jd.solid1 = mFRWheel; ! jd.anchor = M.getPosition(); ! mFRJoint->init(jd); // Add rear left wheel. --- 86,93 ---- // Add front right Joint. mFRJoint = sim->createJoint(); ! jointData.setType(opal::HINGE_2_JOINT); ! jointData.solid1 = mFRWheel; ! jointData.anchor = M.getPosition(); ! mFRJoint->init(jointData); // Add rear left wheel. *************** *** 100,108 **** // Add rear left Joint. mRLJoint = sim->createJoint(); ! jd.type = opal::HINGE_JOINT; ! jd.solid1 = mRLWheel; ! jd.anchor = M.getPosition(); ! jd.axis[0] = wheelAxis; ! mRLJoint->init(jd); // Add rear right wheel. --- 100,108 ---- // Add rear left Joint. mRLJoint = sim->createJoint(); ! jointData.setType(opal::HINGE_JOINT); ! jointData.solid1 = mRLWheel; ! jointData.anchor = M.getPosition(); ! jointData.axis[0] = wheelAxis; ! mRLJoint->init(jointData); // Add rear right wheel. *************** *** 115,123 **** // Add rear right Joint. mRRJoint = sim->createJoint(); ! jd.type = opal::HINGE_JOINT; ! jd.solid1 = mRRWheel; ! jd.anchor = M.getPosition(); ! jd.axis[0] = wheelAxis; ! mRRJoint->init(jd); //translate mass downward to keep car from rolling --- 115,123 ---- // Add rear right Joint. mRRJoint = sim->createJoint(); ! jointData.setType(opal::HINGE_JOINT); ! jointData.solid1 = mRRWheel; ! jointData.anchor = M.getPosition(); ! jointData.axis[0] = wheelAxis; ! mRRJoint->init(jointData); //translate mass downward to keep car from rolling *************** *** 133,146 **** //mRRHinge->setBreakParams(opal::THRESHOLD, 2000.0, 0.0); mFLMotor = sim->createGearedMotor(); ! mFLMotor->init(mFLJoint, 1); ! mFLMotor->setMaxTorque(15); ! mFLMotor->setMaxVelocity(5000); ! mFRMotor = sim->createGearedMotor(); ! mFRMotor->init(mFRJoint, 1); ! mFRMotor->setMaxTorque(15); ! mFRMotor->setMaxVelocity(5000); ! //mBody->setTransform(transform); } --- 133,151 ---- //mRRHinge->setBreakParams(opal::THRESHOLD, 2000.0, 0.0); + // Setup a GearedMotorData object to reuse for both front wheels. + opal::GearedMotorData motorData; + motorData.joint = mFLJoint; + motorData.jointAxisNum = 1; + motorData.maxTorque = 15; + motorData.maxVelocity = 5000; + + // Create and setup the front left Motor. mFLMotor = sim->createGearedMotor(); ! mFLMotor->init(motorData); ! // Create and setup the front right Motor. ! mFRMotor = sim->createGearedMotor(); ! motorData.joint = mFRJoint; ! mFRMotor->init(motorData); } |