本文整理汇总了C++中Primitive::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Primitive::getPosition方法的具体用法?C++ Primitive::getPosition怎么用?C++ Primitive::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Primitive
的用法示例。
在下文中一共展示了Primitive::getPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
//.........这里部分代码省略.........
}
}
std::vector<Primitive*> tarsusParts;
// legs (counted from back to front)
double legdist = conf.size*0.9 / (conf.legNumber/2-1);
for ( int n = 0; n < conf.legNumber; n++ ) {
int v = n;
double len1 = conf.legLength*0.5;
double rad1 = conf.legLength/15;
double len2 = conf.legLength*0.5;
double rad2 = conf.legLength/15;
// upper limp
Primitive* coxaThorax;
Pos pos = Pos(-conf.size/(2+0.2) + ((int)n/2) * legdist,
n%2==0 ? - twidth/2 : twidth/2,
conf.legLength - theight/3);
osg::Matrix m = ROTM(M_PI/2,v%2==0 ? -1 : 1,0,0) * TRANSM(pos) * pose;
coxaThorax = new Capsule(rad1, len1);
coxaThorax->setTexture("Images/toy_fur3.jpg");
coxaThorax->init(odeHandle, legmass, osgHandle);
osg::Matrix m1 = TRANSM(0,0,-len1/2)
* ROTM(M_PI,0,0,v%2==0 ? -1 : 1)
* ROTM(2*M_PI,0,v%2==0 ? -1 : 1,0) * m;
coxaThorax->setPose(m1);
thoraxPos.push_back(coxaThorax->getPosition());
thorax.push_back(coxaThorax);
objects.push_back(coxaThorax);
legs.push_back(coxaThorax);
// powered hip joint
Pos nullpos(0,0,0);
UniversalJoint* j
= new UniversalJoint(trunk, coxaThorax, nullpos * m,
ROTM(M_PI,0,0,v%2==0 ? -1 : 1) * Axis(v%2==0 ? -1 : 1,0,0) * m,
ROTM(M_PI,0,0,v%2==0 ? -1 : 1) * Axis(0,1,0) * m);
j->init(odeHandle, osgHandleJ, true, rad1 * 2.1);
joints.push_back(j);
legContactArray[n].joint = j->getJoint();
// values will be set in setParam later
servo = new TwoAxisServoVel(odeHandle, j,-1,1, 1, -1,1,1,0 );
// servo = new UniversalServo(j,-1,1, 1, -1,1,1,0);
hipservos.push_back(servo);
// lower leg
Primitive* tibia;
tibia = new Capsule(rad2, len2);
tibia->setTexture("Images/toy_fur3.jpg");
tibia->init(odeHandle, legmass, osgHandle);
osg::Matrix m2 = TRANSM(0,0,-len2/2) * ROTM(1.5,v%2==0 ? -1 : 1,0,0)
* TRANSM(0,0,-len1/2) * m1;
tibia->setPose(m2);
objects.push_back(tibia);