本文整理汇总了C++中BodyPart::getSizeY方法的典型用法代码示例。如果您正苦于以下问题:C++ BodyPart::getSizeY方法的具体用法?C++ BodyPart::getSizeY怎么用?C++ BodyPart::getSizeY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BodyPart
的用法示例。
在下文中一共展示了BodyPart::getSizeY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showBodyDetails
void MainWindow::showBodyDetails( const Creature& creature, const BodyPart& body ) {
getUiInspector().lst_body_details->addItem(QString(
body.getName().c_str()));
getUiInspector().lst_body_details->addItem(QString(
(" Mass: " + TO_STRING(body.getMass())).c_str()));
getUiInspector().lst_body_details->addItem(QString(
(" Torque: " + TO_STRING(body.getMaxTorque())).c_str()));
getUiInspector().lst_body_details->addItem(QString(
std::string(" Size").c_str()));
getUiInspector().lst_body_details->addItem(QString(
(" [x]: " + TO_STRING(body.getSizeX())).c_str()));
getUiInspector().lst_body_details->addItem(QString(
(" [y]: " + TO_STRING(body.getSizeY())).c_str()));
getUiInspector().lst_body_details->addItem(QString(
(" [z]: " + TO_STRING(body.getSizeZ())).c_str()));
//Angles
BodyPart* parent = body.getParentId() == Creature::B_NONE
? NULL : &creature.getBodyPart(body.getParentId());
if (parent) {
getUiInspector().lst_body_details->addItem(QString(
(" Parent: " + parent->getName()).c_str()));
// getUiInspector().lst_body_details->addItem(QString(std::string(" Angles:").c_str()));
// getUiInspector().lst_body_details->addItem(QString(
// (" XY:" + TO_STRING(
// MathUtil::getAngle(MathUtil::XY,
// parent->getRigidBody()->getCenterOfMassPosition(),
// body.getRigidBody()->getCenterOfMassPosition()))).c_str()));
// getUiInspector().lst_body_details->addItem(QString(
// (" YZ:" + TO_STRING(
// MathUtil::getAngle(MathUtil::YZ,
// parent->getRigidBody()->getCenterOfMassPosition(),
// body.getRigidBody()->getCenterOfMassPosition()))).c_str()));
// getUiInspector().lst_body_details->addItem(QString(
// (" ZX:" + TO_STRING(
// MathUtil::getAngle(MathUtil::ZX,
// parent->getRigidBody()->getCenterOfMassPosition(),
// body.getRigidBody()->getCenterOfMassPosition()))).c_str()));
}
}
示例2: applyForce
void MainWindow::applyForce( eForceType type ) {
bool play = getSimulationThread().getSimulator().isPlaying();
if (play) {
pause();
}
getSimulationThread().wait();
getSimulationThread().getSimulator().getLock().lockForRead();
Creature* creature = getSimulationThread().getSimulator().currentCreature();
if (creature) {
if (type == FT_NONE) {
for (int i = 0; i < creature->getNumberOfBodyParts(); ++i) {
creature->getBodyPart(i).getRigidBody()->clearForces();
}
getUiInspector().sbx_force_x->setValue(0.0);
getUiInspector().sbx_force_y->setValue(0.0);
getUiInspector().sbx_force_z->setValue(0.0);
} else {
std::vector<btRigidBody*>& bodies = getRendererThread().getRenderer().getSelectedBodyParts();
btVector3 forces(getUiInspector().sbx_force_x->value(),
getUiInspector().sbx_force_y->value(),
getUiInspector().sbx_force_z->value());
for (std::vector<btRigidBody*>::iterator it = bodies.begin();
it != bodies.end(); ++it) {
btRigidBody* rigid_body = *it;
BodyPart* body = NULL;
for (int i = 0; i < creature->getNumberOfBodyParts(); ++i) {
if (creature->getBodyPart(i).getRigidBody() == rigid_body) {
body = &creature->getBodyPart(i);
break;
}
}
assert(body);
rigid_body->activate(true);
switch (type) {
case FT_CENTRAL_FORCE: rigid_body->applyCentralForce(forces);
break;
case FT_CENTRAL_TORQUE: rigid_body->applyTorque(forces);
break;
case FT_IMPULSE_FORCE: rigid_body->applyCentralImpulse(forces);
break;
case FT_IMPULSE_TORQUE: rigid_body->applyTorqueImpulse(forces);
break;
case FT_RELATIVE_FORCE:
break;
case FT_RELATIVE_IMPULSE:
rigid_body->applyImpulse(forces, btVector3(0, -body->getSizeY() / 2.0, 0));
break;
case FT_EACH_STEP:
// creature->setTmpValueX(forces.x());
// creature->setTmpValueY(forces.y());
// creature->setTmpValueZ(forces.z());
break;
default:
BDEBUG(TO_STRING(type));
assert(0);
}
}
}
}
getSimulationThread().getSimulator().getLock().unlock();
if (play) {
this->play();
}
}