Removed the lua state from the physics.

This commit is contained in:
Steffen 2015-01-17 13:11:43 +01:00
parent b897dc5457
commit f496532126
3 changed files with 3 additions and 19 deletions

View File

@ -69,7 +69,7 @@ void Level::load() {
this->physics = Physics();
this->physics.init(L);
this->physics.init();
// currently hard coded should later read this stuff out of a file
this->camera = Camera(glm::vec2(-0.8f, 0.0f), 3.0f);

View File

@ -8,7 +8,7 @@ Physics::Physics() {
Physics::~Physics() {
}
void Physics::init(lua_State* L)
void Physics::init()
{
colConfig = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(colConfig);
@ -16,15 +16,6 @@ void Physics::init(lua_State* L)
solver = new btSequentialImpulseConstraintSolver();
world = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,colConfig);
world->setGravity(btVector3(0,-10,-0));
//Expose the class Physics and its functions
luabridge::getGlobalNamespace(L)
.beginClass<Physics>("Physics")
//.addFunction("", &Physics::)
.endClass();
//Push the physics to Lua as a global variable
luabridge::push(L, this);
lua_setglobal(L, "physics");
}
void Physics::takeUpdateStep(float timeDiff)

View File

@ -7,13 +7,6 @@
#include <string>
#include <stdio.h>
extern "C" {
#include "extern/lua/src/lua.h"
#include "extern/lua/src/lualib.h"
#include "extern/lua/src/lauxlib.h"
}
#include "extern/luabridge/LuaBridge.h"
#include "entity.hh"
#include "extern/bullet/src/BulletDynamics/Dynamics/btRigidBody.h"
@ -51,7 +44,7 @@ class Physics {
public:
Physics();
~Physics();
void init(lua_State* L);
void init();
void takeUpdateStep(float timeDiff); //must be used in level.update to proagate the physics
void rollForward(glm::vec3 camPos, float strength); //self explainitory
void rollLeft(glm::vec3 camPos, float strength);