| 267 | } |
| 268 | |
| 269 | void MotorDemo::initPhysics() |
| 270 | { |
| 271 | m_guiHelper->setUpAxis(1); |
| 272 | |
| 273 | // Setup the basic world |
| 274 | |
| 275 | m_Time = 0; |
| 276 | m_fCyclePeriod = 2000.f; // in milliseconds |
| 277 | |
| 278 | // m_fMuscleStrength = 0.05f; |
| 279 | // new SIMD solver for joints clips accumulated impulse, so the new limits for the motor |
| 280 | // should be (numberOfsolverIterations * oldLimits) |
| 281 | // currently solver uses 10 iterations, so: |
| 282 | m_fMuscleStrength = 0.5f; |
| 283 | |
| 284 | m_collisionConfiguration = new btDefaultCollisionConfiguration(); |
| 285 | |
| 286 | m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration); |
| 287 | |
| 288 | btVector3 worldAabbMin(-10000, -10000, -10000); |
| 289 | btVector3 worldAabbMax(10000, 10000, 10000); |
| 290 | m_broadphase = new btAxisSweep3(worldAabbMin, worldAabbMax); |
| 291 | |
| 292 | m_solver = new btSequentialImpulseConstraintSolver; |
| 293 | |
| 294 | m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration); |
| 295 | |
| 296 | m_dynamicsWorld->setInternalTickCallback(motorPreTickCallback, this, true); |
| 297 | m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld); |
| 298 | |
| 299 | // Setup a big ground box |
| 300 | { |
| 301 | btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(200.), btScalar(10.), btScalar(200.))); |
| 302 | m_collisionShapes.push_back(groundShape); |
| 303 | btTransform groundTransform; |
| 304 | groundTransform.setIdentity(); |
| 305 | groundTransform.setOrigin(btVector3(0, -10, 0)); |
| 306 | createRigidBody(btScalar(0.), groundTransform, groundShape); |
| 307 | } |
| 308 | |
| 309 | // Spawn one ragdoll |
| 310 | btVector3 startOffset(1, 0.5, 0); |
| 311 | spawnTestRig(startOffset, false); |
| 312 | startOffset.setValue(-2, 0.5, 0); |
| 313 | spawnTestRig(startOffset, true); |
| 314 | |
| 315 | m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld); |
| 316 | } |
| 317 | |
| 318 | void MotorDemo::spawnTestRig(const btVector3& startOffset, bool bFixed) |
| 319 | { |
nothing calls this directly
no test coverage detected