Modified adders in physics to no longer accept float x,y,z but entity/object instead.
This commit is contained in:
parent
3c0deb232f
commit
fa60d52676
2
level.cc
2
level.cc
@ -29,7 +29,7 @@ void Level::load(ACGL::OpenGL::SharedShaderProgram shader) {
|
|||||||
Object object = Object(model, material, glm::vec3(0.0f, 10.0f, 0.0f),
|
Object object = Object(model, material, glm::vec3(0.0f, 10.0f, 0.0f),
|
||||||
glm::vec3(0.0f, 0.0f, 0.0f), shader);
|
glm::vec3(0.0f, 0.0f, 0.0f), shader);
|
||||||
//add player to phy
|
//add player to phy
|
||||||
this->physics.addPlayer(1.25f,0.0f,10.0f,0.0f,1.0f,0);
|
this->physics.addPlayer(1.25f,object,1.0f,0);
|
||||||
objects.push_back(object);
|
objects.push_back(object);
|
||||||
|
|
||||||
Model skyboxModel = Model("skybox.obj", skyboxSize);
|
Model skyboxModel = Model("skybox.obj", skyboxSize);
|
||||||
|
@ -75,7 +75,7 @@ void Physics::addStaticGroundPlane()
|
|||||||
world->addRigidBody(staticGroundBody);
|
world->addRigidBody(staticGroundBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Physics::addPlayer(float rad, float x, float y, float z, float mass, unsigned indice)
|
void Physics::addPlayer(float rad, Entity entity, float mass, unsigned indice)
|
||||||
{
|
{
|
||||||
if(bodies.size() != indice)
|
if(bodies.size() != indice)
|
||||||
throw std::invalid_argument( "Bodies out of Sync" );
|
throw std::invalid_argument( "Bodies out of Sync" );
|
||||||
@ -87,7 +87,7 @@ void Physics::addPlayer(float rad, float x, float y, float z, float mass, unsign
|
|||||||
sphere->calculateLocalInertia((btScalar)mass,inertia);
|
sphere->calculateLocalInertia((btScalar)mass,inertia);
|
||||||
}
|
}
|
||||||
|
|
||||||
btDefaultMotionState* motion = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(x,y,z)));
|
btDefaultMotionState* motion = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(entity.getPosition().x,entity.getPosition().y,entity.getPosition().z)));
|
||||||
|
|
||||||
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,sphere,inertia);
|
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,sphere,inertia);
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ void Physics::addBox(float width, float height, float length, Entity entity, flo
|
|||||||
throw std::invalid_argument( "Bodies out of Sync" );
|
throw std::invalid_argument( "Bodies out of Sync" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Physics::addSphere(float rad, float x, float y, float z, float mass, unsigned indice)
|
void Physics::addSphere(float rad, Entity entity, float mass, unsigned indice)
|
||||||
{
|
{
|
||||||
if(bodies.size() != indice)
|
if(bodies.size() != indice)
|
||||||
throw std::invalid_argument( "Bodies out of Sync" );
|
throw std::invalid_argument( "Bodies out of Sync" );
|
||||||
@ -150,7 +150,7 @@ void Physics::addSphere(float rad, float x, float y, float z, float mass, unsign
|
|||||||
sphere->calculateLocalInertia((btScalar)mass,inertia);
|
sphere->calculateLocalInertia((btScalar)mass,inertia);
|
||||||
}
|
}
|
||||||
|
|
||||||
btDefaultMotionState* motion = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(x,y,z)));
|
btDefaultMotionState* motion = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(entity.getPosition().x,entity.getPosition().y,entity.getPosition().z)));
|
||||||
|
|
||||||
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,sphere,inertia);
|
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,sphere,inertia);
|
||||||
//info.
|
//info.
|
||||||
|
@ -48,8 +48,8 @@ class Physics {
|
|||||||
void rollForward(glm::vec3 camPos);
|
void rollForward(glm::vec3 camPos);
|
||||||
void addStaticGroundPlane();
|
void addStaticGroundPlane();
|
||||||
void addTerrain(int width, int length, float** heightData);
|
void addTerrain(int width, int length, float** heightData);
|
||||||
void addPlayer(float rad, float x, float y, float z, float mass, unsigned indice);
|
void addPlayer(float rad, Entity entity, float mass, unsigned indice);
|
||||||
void addSphere(float rad, float x, float y, float z, float mass, unsigned indice);
|
void addSphere(float rad, Entity entity, float mass, unsigned indice);
|
||||||
void addBox(float width, float height, float length, Entity entity, float mass, unsigned indice);
|
void addBox(float width, float height, float length, Entity entity, float mass, unsigned indice);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user