0

x 位置、y 位置、時間、およびバウンスの数を吐き出すだけのバウンドするボールのシミュレーションを作成しようとしています。物理学に関しては完全に機能しますが、問題は、「バウンス」変数を​​インクリメントしようとすると、フレームごとに 1 ではなく 1 ずつ増加し、次のバウンスを待機することです。

関連するループは次のとおりです。

while(bounces<=maxBounces){
    frames++;
    seconds=frames/1000;    

    if(yPos>=0&&bounces==0){
        initRads=getRads(initAng);
        dropBall(initVel, initRads);    
    }
    if(yPos<0){
        yPos=0;
        bounces++;
        cout.precision(5);
        cout<<seconds<<"\t"<<yPos<<"\t"<<xPos<<"\t"<<bounces<<"\n";
        newVel=getVel(currYVel, currXVel, cor);
        newAng = getAng(currYVel,newVel);

        dropBall(newVel, newAng);
    }   
}
4

1 に答える 1