Collisions
This commit is contained in:
+1
-1
Submodule assets updated: 8ab7df0d7f...c44c64df2b
+37
-3
@@ -8,7 +8,15 @@ void GameWorld::Initialize()
|
|||||||
ResourceManager->Preload("Model", "Models/Placeholders/PhysicsTest/Plane.obj");
|
ResourceManager->Preload("Model", "Models/Placeholders/PhysicsTest/Plane.obj");
|
||||||
ResourceManager->Preload("Model", "Models/Placeholders/PhysicsTest/ArrowCube.obj");
|
ResourceManager->Preload("Model", "Models/Placeholders/PhysicsTest/ArrowCube.obj");
|
||||||
|
|
||||||
//Background Music
|
ResourceManager->Preload("Model", "Models/Tank/TankCollisionShape.obj");
|
||||||
|
ResourceManager->Preload("Model", "Models/Tank/tankBody.obj");
|
||||||
|
ResourceManager->Preload("Model", "Models/Tank/tankTop.obj");
|
||||||
|
ResourceManager->Preload("Model", "Models/Tank/tankBarrel.obj");
|
||||||
|
ResourceManager->Preload("Model", "Models/Jeep/Chassi/Chassi.OBJ");
|
||||||
|
ResourceManager->Preload("Model", "Models/Jeep/WheelFront/wheelFront.obj");
|
||||||
|
ResourceManager->Preload("Model", "Models/Jeep/WheelBack/wheelBack.obj");
|
||||||
|
|
||||||
|
//Background Music
|
||||||
{
|
{
|
||||||
Events::PlayBGM e;
|
Events::PlayBGM e;
|
||||||
e.Resource = "Sounds/SFX/WUB.mp3";
|
e.Resource = "Sounds/SFX/WUB.mp3";
|
||||||
@@ -23,6 +31,10 @@ void GameWorld::Initialize()
|
|||||||
BindGamepadButton(Gamepad::Button::Right, "interface_horizontal", 1.f);
|
BindGamepadButton(Gamepad::Button::Right, "interface_horizontal", 1.f);
|
||||||
BindKey(GLFW_KEY_W, "interface_vertical", 1.f);
|
BindKey(GLFW_KEY_W, "interface_vertical", 1.f);
|
||||||
BindKey(GLFW_KEY_S, "interface_vertical", -1.f);
|
BindKey(GLFW_KEY_S, "interface_vertical", -1.f);
|
||||||
|
|
||||||
|
BindKey(GLFW_KEY_W, "jeep_vertical", 1.f);
|
||||||
|
BindKey(GLFW_KEY_S, "jeep_vertical", -1.f);
|
||||||
|
|
||||||
BindGamepadAxis(Gamepad::Axis::LeftY, "interface_vertical", 1.f);
|
BindGamepadAxis(Gamepad::Axis::LeftY, "interface_vertical", 1.f);
|
||||||
BindGamepadButton(Gamepad::Button::Up, "interface_vertical", 1.f);
|
BindGamepadButton(Gamepad::Button::Up, "interface_vertical", 1.f);
|
||||||
BindGamepadButton(Gamepad::Button::Down, "interface_vertical", -1.f);
|
BindGamepadButton(Gamepad::Button::Down, "interface_vertical", -1.f);
|
||||||
@@ -869,6 +881,18 @@ void GameWorld::CreateTerrain()
|
|||||||
auto transform = AddComponent<Components::Transform>(decoration_middle);
|
auto transform = AddComponent<Components::Transform>(decoration_middle);
|
||||||
auto model = AddComponent<Components::Model>(decoration_middle);
|
auto model = AddComponent<Components::Model>(decoration_middle);
|
||||||
model->ModelFile = "Models/TerrainFiveIstles/Decoration/Middle.obj";
|
model->ModelFile = "Models/TerrainFiveIstles/Decoration/Middle.obj";
|
||||||
|
auto physics = AddComponent<Components::Physics>(decoration_middle);
|
||||||
|
physics->Mass = 1.f;
|
||||||
|
physics->MotionType = Components::Physics::MotionTypeEnum::Fixed;
|
||||||
|
|
||||||
|
{
|
||||||
|
auto shape = CreateEntity(decoration_middle);
|
||||||
|
auto transform = AddComponent<Components::Transform>(shape);
|
||||||
|
auto mesh = AddComponent<Components::MeshShape>(shape);
|
||||||
|
mesh->ResourceName = "Models/TerrainFiveIstles/Decoration/Middle.obj";
|
||||||
|
CommitEntity(shape);
|
||||||
|
}
|
||||||
|
|
||||||
CommitEntity(decoration_middle);
|
CommitEntity(decoration_middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1184,6 +1208,16 @@ void GameWorld::CreateBase(glm::quat orientation, int teamID)
|
|||||||
auto transform = AddComponent<Components::Transform>(decoration_base);
|
auto transform = AddComponent<Components::Transform>(decoration_base);
|
||||||
auto model = AddComponent<Components::Model>(decoration_base);
|
auto model = AddComponent<Components::Model>(decoration_base);
|
||||||
model->ModelFile = "Models/TerrainFiveIstles/Decoration/Base.obj";
|
model->ModelFile = "Models/TerrainFiveIstles/Decoration/Base.obj";
|
||||||
|
auto physics = AddComponent<Components::Physics>(decoration_base);
|
||||||
|
physics->MotionType = Components::Physics::MotionTypeEnum::Fixed;
|
||||||
|
physics->Mass = 1.f;
|
||||||
|
{
|
||||||
|
auto shape = CreateEntity(decoration_base);
|
||||||
|
auto transform = AddComponent<Components::Transform>(shape);
|
||||||
|
auto mesh = AddComponent<Components::MeshShape>(shape);
|
||||||
|
mesh->ResourceName = "Models/TerrainFiveIstles/Decoration/BaseCollision.obj";
|
||||||
|
CommitEntity(shape);
|
||||||
|
}
|
||||||
CommitEntity(decoration_base);
|
CommitEntity(decoration_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1439,10 +1473,10 @@ EntityID GameWorld::CreateGarage(EntityID parent, glm::vec3 Position, glm::quat
|
|||||||
{
|
{
|
||||||
auto shape = CreateEntity(elevator);
|
auto shape = CreateEntity(elevator);
|
||||||
auto transform = AddComponent<Components::Transform>(shape);
|
auto transform = AddComponent<Components::Transform>(shape);
|
||||||
transform->Position = glm::vec3(0, 0, 0);
|
transform->Position = glm::vec3(0, -2, 0);
|
||||||
auto box = AddComponent<Components::BoxShape>(shape);
|
auto box = AddComponent<Components::BoxShape>(shape);
|
||||||
box->Width = 4.754f;
|
box->Width = 4.754f;
|
||||||
box->Height = 0.141f;
|
box->Height = 2.141f;
|
||||||
box->Depth = 6.86f;
|
box->Depth = 6.86f;
|
||||||
CommitEntity(shape);
|
CommitEntity(shape);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,5 @@ bool Systems::DamageSystem::OnDamage( const Events::Damage &event )
|
|||||||
e.Entity = event.Entity;
|
e.Entity = event.Entity;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOG_INFO("Damaged entity %i, Health left: %f", event.Entity, health->Amount);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ bool Systems::GameStateSystem::OnFlagCaptured(const Events::FlagCaptured &event)
|
|||||||
m_InGame = false;
|
m_InGame = false;
|
||||||
|
|
||||||
Events::GameOver e1;
|
Events::GameOver e1;
|
||||||
e.Player = event.Player;
|
e1.Player = event.Player;
|
||||||
EventBroker->Publish(e1);
|
EventBroker->Publish(e1);
|
||||||
Events::PlayBGM e2;
|
Events::PlayBGM e2;
|
||||||
e2.Resource = "Sounds/BGM/WilliamTellOverture.mp3";
|
e2.Resource = "Sounds/BGM/WilliamTellOverture.mp3";
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ void Systems::ParticleSystem::ScalarInterpolation(double timeProgress, std::vect
|
|||||||
|
|
||||||
bool Systems::ParticleSystem::CreateExplosion(const Events::CreateExplosion &e)
|
bool Systems::ParticleSystem::CreateExplosion(const Events::CreateExplosion &e)
|
||||||
{
|
{
|
||||||
LOG_INFO("Spawning an explosion");
|
|
||||||
auto explosion = m_World->CreateEntity();
|
auto explosion = m_World->CreateEntity();
|
||||||
auto emitter = m_World->AddComponent<Components::ParticleEmitter>(explosion);
|
auto emitter = m_World->AddComponent<Components::ParticleEmitter>(explosion);
|
||||||
emitter->LifeTime = e.LifeTime;
|
emitter->LifeTime = e.LifeTime;
|
||||||
|
|||||||
@@ -787,7 +787,6 @@ void Systems::PhysicsSystem::OnComponentRemoved(EntityID entity, std::string typ
|
|||||||
|
|
||||||
if(m_RigidBodies.find(entity) != m_RigidBodies.end())
|
if(m_RigidBodies.find(entity) != m_RigidBodies.end())
|
||||||
{
|
{
|
||||||
LOG_INFO("Removed Trigger of entity %i", entity);
|
|
||||||
m_PhysicsWorld->markForWrite();
|
m_PhysicsWorld->markForWrite();
|
||||||
m_RigidBodyEntities.erase(m_RigidBodies[entity]);
|
m_RigidBodyEntities.erase(m_RigidBodies[entity]);
|
||||||
m_PhysicsWorld->removeEntity(m_RigidBodies[entity]);
|
m_PhysicsWorld->removeEntity(m_RigidBodies[entity]);
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ public:
|
|||||||
e.Entity1 = entity1;
|
e.Entity1 = entity1;
|
||||||
e.Entity2 = entity2;
|
e.Entity2 = entity2;
|
||||||
m_PhysicsSystem->EventBroker->Publish(e);
|
m_PhysicsSystem->EventBroker->Publish(e);
|
||||||
LOG_INFO("CollisionEvent!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ EntityID Systems::TankSteeringSystem::CreateTank(int playerID)
|
|||||||
m_World->AddComponent<Components::Input>(tank);
|
m_World->AddComponent<Components::Input>(tank);
|
||||||
m_World->AddComponent<Components::Listener>(tank);
|
m_World->AddComponent<Components::Listener>(tank);
|
||||||
auto health = m_World->AddComponent<Components::Health>(tank);
|
auto health = m_World->AddComponent<Components::Health>(tank);
|
||||||
health->Amount = 1.f;
|
health->Amount = 200.f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user