| 69 | } |
| 70 | |
| 71 | void FixedTimeAnimation::initialize() |
| 72 | { |
| 73 | #if (COIN_MAJOR_VERSION * 100 + COIN_MINOR_VERSION * 10 + COIN_MICRO_VERSION < 403) |
| 74 | navigation->findBoundingSphere(); |
| 75 | #endif |
| 76 | |
| 77 | prevAngle = 0; |
| 78 | prevTranslation = SbVec3f(0, 0, 0); |
| 79 | |
| 80 | // Find an axis and angle to rotate from the camera orientation to the target orientation using |
| 81 | // post-multiplication |
| 82 | SbVec3f rotationAxisPost; |
| 83 | float angle; |
| 84 | SbRotation(navigation->getCamera()->orientation.getValue().inverse() * targetOrientation) |
| 85 | .getValue(rotationAxisPost, angle); |
| 86 | if (angle > std::numbers::pi) { |
| 87 | angle -= float(2 * std::numbers::pi); |
| 88 | } |
| 89 | |
| 90 | // Convert post-multiplication axis to a pre-multiplication axis |
| 91 | navigation->getCamera()->orientation.getValue().inverse().multVec(rotationAxisPost, rotationAxis); |
| 92 | |
| 93 | angularVelocity = angle / duration(); |
| 94 | linearVelocity = targetTranslation / duration(); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * @param value The elapsed time |
nothing calls this directly
no test coverage detected