I want to build my own 2D mini-physics engine, that will include(for now) rigid bodys, and constraints (joints, contacts, springs...).
And I've tried to figure out what is the right order of the phases, when I start a timestep,
when the the general phases are: Broadphase, Narrow phase(Collision Detection, and Contact generation),
Resolution (Constraints Solver), and the Integration - hope you can tell me the right order.
I allso have general questions about each phase:
Narrow Phase - When I've found a collision do I need to seperate the bodies after I've found the collision or just apply an impulse to their velocities in the resolution phase?
and if I'm using CCD(Continuous Collision Detection) for some bodies, what happand if I've found a collision (the earliest for object A) of a fast moving object A with other object B, and than I found that object B will collide with other object C before object he will collide with object A, do I need to go back to object A and looking for other collisions after the first collision I've found to him?
and if I'm using Contact Solver in my engine (in the constraints solver, I'll generat A Contact constraints for each collision, and I'll solve then all in the resolution phase, or I'll solve each contact right after I've found them in the narrow phase?
Resolution - Using a constaints Solver for the resolution phase is ok?
and what if by solving one constraint I'll solve other constraints or make more constraints? (Do I need to check after each constraints solving if it solves other constraints or make more?
Intefration - this is the part where I take all the information I gathered (impulses, forces..) and intefrate them to velocity and than to position with the integration method I chose?
A symplectic euler integration will be enough for my physics engine?
and I alsso saw in many physics engines, like box2D, they use iterations and let me chose the frequncy like here (notice I can change the iteration count (10) and the frequency (60.0 Hz)):
What does this variables means? the iterations is how many times I recall the physics update(all the phases above) in each frame, or it just recall one phase like the narrow phase or somthing like that?
and the frequency variable let me chose how many frames there will be in one second?
correct me if i'm worng please.
all the qeustions above get me stack from learning because its basics things, and i didnt found a place that explain this things in a clean and strait forward
so thanks for anyone who will read all of that, and especially for anyone who will also help me with all of my questions :)
See Question&Answers more detail:
os