| 895 | } |
| 896 | |
| 897 | void b2World::Step(float32 dt, int32 velocityIterations, int32 positionIterations) |
| 898 | { |
| 899 | b2Timer stepTimer; |
| 900 | |
| 901 | // If new fixtures were added, we need to find the new contacts. |
| 902 | if (m_flags & e_newFixture) |
| 903 | { |
| 904 | m_contactManager.FindNewContacts(); |
| 905 | m_flags &= ~e_newFixture; |
| 906 | } |
| 907 | |
| 908 | m_flags |= e_locked; |
| 909 | |
| 910 | b2TimeStep step; |
| 911 | step.dt = dt; |
| 912 | step.velocityIterations = velocityIterations; |
| 913 | step.positionIterations = positionIterations; |
| 914 | if (dt > 0.0f) |
| 915 | { |
| 916 | step.inv_dt = 1.0f / dt; |
| 917 | } |
| 918 | else |
| 919 | { |
| 920 | step.inv_dt = 0.0f; |
| 921 | } |
| 922 | |
| 923 | step.dtRatio = m_inv_dt0 * dt; |
| 924 | |
| 925 | step.warmStarting = m_warmStarting; |
| 926 | |
| 927 | // Update contacts. This is where some contacts are destroyed. |
| 928 | { |
| 929 | b2Timer timer; |
| 930 | m_contactManager.Collide(); |
| 931 | m_profile.collide = timer.GetMilliseconds(); |
| 932 | } |
| 933 | |
| 934 | // Integrate velocities, solve velocity constraints, and integrate positions. |
| 935 | if (m_stepComplete && step.dt > 0.0f) |
| 936 | { |
| 937 | b2Timer timer; |
| 938 | Solve(step); |
| 939 | m_profile.solve = timer.GetMilliseconds(); |
| 940 | } |
| 941 | |
| 942 | // Handle TOI events. |
| 943 | if (m_continuousPhysics && step.dt > 0.0f) |
| 944 | { |
| 945 | b2Timer timer; |
| 946 | SolveTOI(step); |
| 947 | m_profile.solveTOI = timer.GetMilliseconds(); |
| 948 | } |
| 949 | |
| 950 | if (step.dt > 0.0f) |
| 951 | { |
| 952 | m_inv_dt0 = step.inv_dt; |
| 953 | } |
| 954 |
nothing calls this directly
no test coverage detected