Initialize the bodies positions
| 93 | |
| 94 | // Initialize the bodies positions |
| 95 | void JointsScene::initBodiesPositions() { |
| 96 | |
| 97 | openglframework::Vector3 positionBox(0, 15, 5); |
| 98 | openglframework::Vector3 boxDimension(1, 1, 1); |
| 99 | |
| 100 | for (int i=0; i<NB_BALLSOCKETJOINT_BOXES; i++) { |
| 101 | |
| 102 | // Initial position and orientation of the rigid body |
| 103 | rp3d::Vector3 initPosition(positionBox.x, positionBox.y, positionBox.z); |
| 104 | rp3d::Quaternion initOrientation = rp3d::Quaternion::identity(); |
| 105 | rp3d::Transform transform(initPosition, initOrientation); |
| 106 | |
| 107 | // Create a box and a corresponding rigid in the physics world |
| 108 | mBallAndSocketJointChainBoxes[i]->setTransform(transform); |
| 109 | |
| 110 | positionBox.y -= boxDimension.y + 0.5f; |
| 111 | } |
| 112 | |
| 113 | // --------------- Slider Joint --------------- // |
| 114 | |
| 115 | // Position of the box |
| 116 | openglframework::Vector3 positionBox1(0, 2.1f, 0); |
| 117 | rp3d::Vector3 initPosition(positionBox1.x, positionBox1.y, positionBox1.z); |
| 118 | rp3d::Quaternion initOrientation = rp3d::Quaternion::identity(); |
| 119 | rp3d::Transform transformBottomBox(initPosition, initOrientation); |
| 120 | |
| 121 | // Create a box and a corresponding rigid in the physics world |
| 122 | mSliderJointBottomBox->setTransform(transformBottomBox); |
| 123 | |
| 124 | // Position of the box |
| 125 | openglframework::Vector3 positionBox2(0, 4.2f, 0); |
| 126 | initPosition = rp3d::Vector3(positionBox2.x, positionBox2.y, positionBox2.z); |
| 127 | initOrientation = rp3d::Quaternion::identity(); |
| 128 | rp3d::Transform transformTopBox(initPosition, initOrientation); |
| 129 | |
| 130 | // Create a box and a corresponding rigid in the physics world |
| 131 | mSliderJointTopBox->setTransform(transformTopBox); |
| 132 | |
| 133 | // --------------- Propeller Hinge joint --------------- // |
| 134 | |
| 135 | // Position of the box |
| 136 | positionBox1 = openglframework::Vector3(0, 7, 0); |
| 137 | initPosition = rp3d::Vector3(positionBox1.x, positionBox1.y, positionBox1.z); |
| 138 | initOrientation = rp3d::Quaternion::identity(); |
| 139 | rp3d::Transform transformHingeBox(initPosition, initOrientation); |
| 140 | |
| 141 | // Create a box and a corresponding rigid in the physics world |
| 142 | mPropellerBox->setTransform(transformHingeBox); |
| 143 | |
| 144 | // --------------- Fixed joint --------------- // |
| 145 | |
| 146 | // Position of the box |
| 147 | positionBox1 = openglframework::Vector3(5, 7, 0); |
| 148 | initPosition = rp3d::Vector3(positionBox1.x, positionBox1.y, positionBox1.z); |
| 149 | initOrientation = rp3d::Quaternion::identity(); |
| 150 | rp3d::Transform transformFixedBox1(initPosition, initOrientation); |
| 151 | |
| 152 | // Create a box and a corresponding rigid in the physics world |
nothing calls this directly
no test coverage detected