|
|
@ -66,6 +66,7 @@ public: |
|
|
|
AddLine({76,68},{132,68},5); |
|
|
|
AddLine({76,68},{132,68},5); |
|
|
|
AddLine({4,12},{4,60},5); |
|
|
|
AddLine({4,12},{4,60},5); |
|
|
|
AddLine({140,12},{140,60},5); |
|
|
|
AddLine({140,12},{140,60},5); |
|
|
|
|
|
|
|
ConsoleCaptureStdOut(true); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -127,9 +128,13 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(GetKey(F1).bPressed){ |
|
|
|
|
|
|
|
ConsoleShow(F1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Clear(BLACK); |
|
|
|
Clear(BLACK); |
|
|
|
|
|
|
|
|
|
|
|
float stable=0.01f; |
|
|
|
float stable=0.05f; |
|
|
|
int simulationUpdates=4; |
|
|
|
int simulationUpdates=4; |
|
|
|
int maxSimulationSteps=15; |
|
|
|
int maxSimulationSteps=15; |
|
|
|
float simElapsedTime=fElapsedTime/(float)simulationUpdates; |
|
|
|
float simElapsedTime=fElapsedTime/(float)simulationUpdates; |
|
|
@ -183,11 +188,11 @@ public: |
|
|
|
Ball*fakeBall=new Ball(); |
|
|
|
Ball*fakeBall=new Ball(); |
|
|
|
fakeBall->radius=l.radius; |
|
|
|
fakeBall->radius=l.radius; |
|
|
|
fakeBall->mass=b.mass*0.8f; |
|
|
|
fakeBall->mass=b.mass*0.8f; |
|
|
|
fakeBall->pos=closestPoint; |
|
|
|
fakeBall->pos={closestPoint.x,closestPoint.y}; |
|
|
|
fakeBall->vel={-b.vel.x,-b.vel.y}; |
|
|
|
fakeBall->vel={-b.vel.x,-b.vel.y}; |
|
|
|
fakeBalls.push_back(fakeBall); |
|
|
|
fakeBalls.push_back(fakeBall); |
|
|
|
collidingPairs.push_back({&b,fakeBall}); |
|
|
|
collidingPairs.push_back({&b,fakeBall}); |
|
|
|
float overlap=1.f*(dist-b.radius-fakeBall->radius); |
|
|
|
float overlap=1.1f*(dist-b.radius-fakeBall->radius); |
|
|
|
b.pos.x-=overlap*(b.pos.x-fakeBall->pos.x)/dist; |
|
|
|
b.pos.x-=overlap*(b.pos.x-fakeBall->pos.x)/dist; |
|
|
|
b.pos.y-=overlap*(b.pos.y-fakeBall->pos.y)/dist; |
|
|
|
b.pos.y-=overlap*(b.pos.y-fakeBall->pos.y)/dist; |
|
|
|
} |
|
|
|
} |
|
|
|