| 470 | void tutorialSolveContactConstraintUpdate(float deltaTime, LWContactPoint& contact); |
| 471 | |
| 472 | virtual void stepSimulation(float deltaTime) |
| 473 | { |
| 474 | switch (m_tutorialIndex) |
| 475 | { |
| 476 | case TUT_VELOCITY: |
| 477 | { |
| 478 | tutorial1Update(deltaTime); |
| 479 | float xPos = m_bodies[0]->m_worldPose.m_position.x; |
| 480 | float xVel = m_bodies[0]->m_linearVelocity.x; |
| 481 | m_timeSeriesCanvas0->insertDataAtCurrentTime(xPos, 0, true); |
| 482 | m_timeSeriesCanvas0->insertDataAtCurrentTime(xVel, 1, true); |
| 483 | break; |
| 484 | } |
| 485 | case TUT_ACCELERATION: |
| 486 | { |
| 487 | tutorial2Update(deltaTime); |
| 488 | float yPos = m_bodies[0]->m_worldPose.m_position.y; |
| 489 | float yVel = m_bodies[0]->m_linearVelocity.y; |
| 490 | m_timeSeriesCanvas1->insertDataAtCurrentTime(yPos, 0, true); |
| 491 | m_timeSeriesCanvas1->insertDataAtCurrentTime(yVel, 1, true); |
| 492 | |
| 493 | break; |
| 494 | } |
| 495 | case TUT_COLLISION: |
| 496 | { |
| 497 | m_contactPoints.clear(); |
| 498 | LWContactPoint contactPoint; |
| 499 | tutorialCollisionUpdate(deltaTime, contactPoint); |
| 500 | m_contactPoints.push_back(contactPoint); |
| 501 | m_timeSeriesCanvas1->insertDataAtCurrentTime(contactPoint.m_distance, 0, true); |
| 502 | |
| 503 | break; |
| 504 | } |
| 505 | case TUT_SOLVE_CONTACT_CONSTRAINT: |
| 506 | { |
| 507 | m_contactPoints.clear(); |
| 508 | LWContactPoint contactPoint; |
| 509 | tutorialSolveContactConstraintUpdate(deltaTime, contactPoint); |
| 510 | m_contactPoints.push_back(contactPoint); |
| 511 | if (contactPoint.m_distance < 0) |
| 512 | { |
| 513 | m_bodies[0]->computeInvInertiaTensorWorld(); |
| 514 | m_bodies[1]->computeInvInertiaTensorWorld(); |
| 515 | |
| 516 | b3Scalar appliedImpulse = resolveCollision(*m_bodies[0], |
| 517 | *m_bodies[1], |
| 518 | contactPoint); |
| 519 | |
| 520 | m_timeSeriesCanvas1->insertDataAtCurrentTime(appliedImpulse, 1, true); |
| 521 | } |
| 522 | else |
| 523 | { |
| 524 | m_timeSeriesCanvas1->insertDataAtCurrentTime(0., 1, true); |
| 525 | } |
| 526 | m_timeSeriesCanvas1->insertDataAtCurrentTime(contactPoint.m_distance, 0, true); |
| 527 | |
| 528 | break; |
| 529 | } |
nothing calls this directly
no test coverage detected