本文整理汇总了C++中Helicopter::getJoystick方法的典型用法代码示例。如果您正苦于以下问题:C++ Helicopter::getJoystick方法的具体用法?C++ Helicopter::getJoystick怎么用?C++ Helicopter::getJoystick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helicopter
的用法示例。
在下文中一共展示了Helicopter::getJoystick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maxSpead
void RealTimeTest::maxSpead() {
Hud *maxSpeadTestingHud = game.getHudsManager()->createHud(HudAlignment::RIGHT);
maxSpeadTestingHud->setText("MAX SPEAD TESTING STARTED...");
DelayCommand dc(15);
dc.execute();
Helicopter *helicopter = game.getHelicopter();
JoystickMoveForward jmf(helicopter->getJoystick());
RotorNeutral rn(helicopter->getMainRotor());
float oldV = 0;
float newV = 0;
std::cout << "\nmaxSpead test started:" << std::endl;
game.getConfiguration()->activateFriction();
helicopter->reset();
helicopter->setPosistion(osg::Vec3f(0, 0, 600));
jmf.execute();
rn.execute();
do {
oldV = newV;
dc.execute();
newV = helicopter->getVelocity().x();
} while (oldV < newV);
// viscous resistance = v * (6 * WORLD_PI * 0.001 * 4)
// if joystick(theta = 15, phi = 0) and throttle(9.8), then
// ax = sin15 * 9.8 = 0.2588 * 9.8 = 2.53624
// viscous resistance should be equal 2.53624
// v * (6 * WORLD_PI * 0.001 * 4) = 2.53624 <= now solve for v
// v = 2.53624 / (6 * WORLD_PI * 0.001 * 4)
// v = 33.6379
Assert(33.6379, helicopter->getVelocity().x(), 0.01);
std::cout << "maxSpead test passed" << std::endl;
std::cout << "maxSpead test results:" << std::endl;
std::cout << "vx = " << helicopter->getVelocity().x() << std::endl;
maxSpeadTestingHud->setText("HOVER TESTING PASSED...");
}