Initialize the bodies positions
| 91 | |
| 92 | // Initialize the bodies positions |
| 93 | void CubesScene::initBodiesPositions() { |
| 94 | |
| 95 | const float radius = 2.0f; |
| 96 | |
| 97 | // Create all the cubes of the scene |
| 98 | std::vector<Box*>::iterator it; |
| 99 | int i = 0; |
| 100 | for (it = mBoxes.begin(); it != mBoxes.end(); ++it) { |
| 101 | |
| 102 | // Position of the cubes |
| 103 | float angle = i * 30.0f; |
| 104 | rp3d::Vector3 position; |
| 105 | |
| 106 | if (i == 0) { |
| 107 | |
| 108 | position = rp3d::Vector3(0, 5, 0); |
| 109 | } |
| 110 | else { |
| 111 | |
| 112 | position = rp3d::Vector3(radius * std::cos(angle), |
| 113 | 10 + i * (BOX_SIZE.y + 0.3f), |
| 114 | 0); |
| 115 | } |
| 116 | |
| 117 | (*it)->setTransform(rp3d::Transform(position, rp3d::Quaternion::identity())); |
| 118 | |
| 119 | i++; |
| 120 | } |
| 121 | |
| 122 | mFloor->setTransform(rp3d::Transform(rp3d::Vector3::zero(), rp3d::Quaternion::identity())); |
| 123 | } |
| 124 | |
| 125 | // Destroy the physics world |
| 126 | void CubesScene::destroyPhysicsWorld() { |
nothing calls this directly
no test coverage detected