Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. for (unsigned i = 0; i < numContacts; i++)
  2. {
  3. // Check each body in the contact
  4. for (unsigned b = 0; b < 2; b++) if (c[i].body[b])
  5. {
  6. // Check for a match with each body in the newly
  7. // resolved contact
  8. for (unsigned d = 0; d < 2; d++)
  9. {
  10. if (c[i].body[b] == c[index].body[d])
  11. {
  12. deltaVel = velocityChange[d] +
  13. rotationChange[d].vectorProduct(
  14. c[i].relativeContactPosition[b]);
  15.  
  16. // The sign of the change is negative if we're dealing
  17. // with the second body in a contact.
  18. c[i].contactVelocity +=
  19. c[i].contactToWorld.transformTranspose(deltaVel)
  20. * (b?-1:1);
  21. c[i].calculateDesiredDeltaVelocity(duration);
  22. }
  23. }
  24. }
  25. }
  26. velocityIterationsUsed++;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement