Exemplo n.º 1
0
void update()
{

    glm::vec3 tempPlayerOne = glm::vec3(objectsDataList.getModelMatrix(1)[3][0], objectsDataList.getModelMatrix(1)[3][1], objectsDataList.getModelMatrix(1)[3][2]);

    //glm::vec3 tempPlayerTwo = glm::vec3(objectsDataList.getModelMatrix(2)[3][0], objectsDataList.getModelMatrix(2)[3][1], objectsDataList.getModelMatrix(2)[3][2]);

    //glm::vec3 puckLoc = glm::vec3(objectsDataList.getModelMatrix(3)[3][0], objectsDataList.getModelMatrix(3)[3][1], objectsDataList.getModelMatrix(3)[3][2]);

    //cout << "Makes it to update!" << endl;
    float dt = getDT();
    int counter; 

    // pass dt to all objects and let them update themselves based on their
    // current flags/status
    if(!pauseBool)
    {
        dynamicsWorld->setGravity(btVector3(gravityX, -10, gravityZ)); 
        dynamicsWorld->stepSimulation(dt, 10.0f);

        for (counter = 0; counter < globalObjCount; counter++)
        {
            objectsDataList.updateObject(counter);
        }
    }

    switch(viewNum)
        {
            case 0:
                 view = glm::lookAt( glm::vec3(camX, camY, camZ), //Eye Position
                                glm::vec3(0, 0.0, 0.0), //Focus point
                                glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up
                break;

            case 1:
                view = glm::lookAt( glm::vec3(tempPlayerOne.x + camX + offsetX, 30.0 + offsetY, tempPlayerOne.z + camZ + offsetZ), //Eye Position
                        glm::vec3(tempPlayerOne.x + offsetX, tempPlayerOne.y + offsetY, tempPlayerOne.z + offsetZ), //Focus point
                        glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up
                break;

            case 2:
                //view = glm::lookAt( glm::vec3(tempPlayerTwo.x, 40.0, tempPlayerTwo.z), //Eye Position
                        //glm::vec3(tempPlayerTwo.x, tempPlayerTwo.y, tempPlayerTwo.z), //Focus point
                        //glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up
                break;

        }

    //checkGoal();
   
    // Update the state of the scene
    glutPostRedisplay();//call the display callback    
}
Exemplo n.º 2
0
void update()
{
    //cout << "Makes it to update!" << endl;
    float dt = getDT();
    int counter; 

    // pass dt to all objects and let them update themselves based on their
    // current flags/status

    //cout << "Gets to before stepsim" << endl;  
    dynamicsWorld->stepSimulation(dt, 10.0f);

    //cout << "GLOBAL COUNT" << globalObjCount << endl;

    for (counter = 0; counter < globalObjCount; counter++)
    {
        objectsDataList.updateObject(counter);
    }

    // Update the state of the scene
    glutPostRedisplay();//call the display callback
}