]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
eventBoxen working again
authorPeter Schaefer <schaeferpm@gmail.com>
Mon, 22 Jun 2015 12:34:24 +0000 (14:34 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Mon, 22 Jun 2015 12:34:24 +0000 (14:34 +0200)
Weave/Game.cpp
Weave/Scene/EventBox.cpp
Weave/Scene/Marvin.cpp
Weave/Scene/SceneObject.h

index 936007264e978f3ede11b6dadc326c54deeddf8f..bd356084f3781e652c54507ad8a3c52fbde1d340 100644 (file)
@@ -71,7 +71,7 @@ Game::Game() : playing(true)
        current_world->addObject(new SceneObject(shader1, translate(vec3(-5.f, 3.f, 0.f)), vec4(3.0f, 3.f, 0.4f, 1.5f), "SkyBox.dae", "model_SkyBox_2D.png"));
 
        //current_world->addObject(new EventBox(translate(vec3(3.f, .4f, 0.f)),EB_LOSTZONE));
-       //current_world->addObject(new EventBox(translate(vec3(3.f, .4f, -15.f)), EB_WINZONE));
+       current_world->addObject(new EventBox(translate(vec3(3.f, .4f, -15.f)), EB_WINZONE));
 
 }
 
index 196072bcdf583991758ba962af2c5be0514fc3a8..404b850afd8f30d6d07378b1cad5a2c2f1dc7435 100644 (file)
@@ -15,6 +15,21 @@ EventBox::EventBox(const mat4& _modelMat, uint _EB_TYPE) :
        SceneObject(Graphix::shader_BBox, _modelMat, vec4(0.f), Model::getBBoxModel(), ""), 
        eb_type(_EB_TYPE)
 {
+       collide_group = COL_EVENT;
+       collide_with = COL_MARVIN;
+
+       btTransform btModelMat;
+       btModelMat.setFromOpenGLMatrix(value_ptr(modelMat));
+
+       btDefaultMotionState* MotionState =
+               new btDefaultMotionState(btModelMat);
+       btRigidBody::btRigidBodyConstructionInfo RigidBodyCI(0, MotionState, *model, btVector3(0, 0, 0));
+
+       bt_rigid_body = new btRigidBody(RigidBodyCI);
+
+       btTransform tmp;
+       tmp.setFromOpenGLMatrix(value_ptr(modelMat));
+       bt_collision_object->setWorldTransform(tmp);
 }
 
 
index 4fe18f7ac23b0d5b645129a4dc6b76b30d45c3cc..1d4bbd6ef800e90dab4656e93b9b1ec610349331 100644 (file)
@@ -16,7 +16,7 @@ Marvin::Marvin(Shader* _shader, const mat4& _modelMat) :
 SceneObject(_shader, _modelMat, vec4(7.0f, 0.7f, 1.0f, 3.0f), "Player.dae", "model_player_2D.png")
 {
        collide_group = COL_MARVIN;
-       collide_with = COL_LEVEL | COL_ENEMY;
+       collide_with = COL_LEVEL | COL_ENEMY | COL_EVENT;
 }
 
 
index e1a13512457a6cfd3f43c6b81ee6e104903f9466..ba15fbe0dfeef97285d925c344dee2ab874156e5 100644 (file)
@@ -18,7 +18,8 @@ enum collisiontypes {
        COL_LEVEL = BIT(0), //<Collide with LEVEL
        COL_MARVIN = BIT(1), //<Collide with Marvin
        COL_ENEMY = BIT(2), //<Collide with Enemies
-       COL_KEY = BIT(3) //<Collide with Key's
+       COL_KEY = BIT(3), //<Collide with Key's
+       COL_EVENT = BIT(4)
 };
 
 //class string;