MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / keyboardCallback

Method keyboardCallback

examples/Vehicles/Hinge2Vehicle.cpp:489–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489bool Hinge2Vehicle::keyboardCallback(int key, int state)
490{
491 bool handled = false;
492 bool isShiftPressed = m_guiHelper->getAppInterface()->m_window->isModifierKeyPressed(B3G_SHIFT);
493
494 if (state)
495 {
496 if (isShiftPressed)
497 {
498 }
499 else
500 {
501 switch (key)
502 {
503 case B3G_LEFT_ARROW:
504 {
505 handled = true;
506 gVehicleSteering += steeringIncrement;
507 if (gVehicleSteering > steeringClamp)
508 gVehicleSteering = steeringClamp;
509
510 break;
511 }
512 case B3G_RIGHT_ARROW:
513 {
514 handled = true;
515 gVehicleSteering -= steeringIncrement;
516 if (gVehicleSteering < -steeringClamp)
517 gVehicleSteering = -steeringClamp;
518
519 break;
520 }
521 case B3G_UP_ARROW:
522 {
523 handled = true;
524 gEngineForce = maxEngineForce;
525 gBreakingForce = 0.f;
526 break;
527 }
528 case B3G_DOWN_ARROW:
529 {
530 handled = true;
531 gEngineForce = -maxEngineForce;
532 gBreakingForce = 0.f;
533 break;
534 }
535
536 case B3G_F7:
537 {
538 handled = true;
539 btDiscreteDynamicsWorld* world = (btDiscreteDynamicsWorld*)m_dynamicsWorld;
540 world->setLatencyMotionStateInterpolation(!world->getLatencyMotionStateInterpolation());
541 printf("world latencyMotionStateInterpolation = %d\n", world->getLatencyMotionStateInterpolation());
542 break;
543 }
544 case B3G_F6:
545 {
546 handled = true;

Callers

nothing calls this directly

Calls 3

isModifierKeyPressedMethod · 0.45
getAppInterfaceMethod · 0.45
setConstraintSolverMethod · 0.45

Tested by

no test coverage detected