diff --git a/src/GameWorld.cpp b/src/GameWorld.cpp index 659e628..d9ffd16 100755 --- a/src/GameWorld.cpp +++ b/src/GameWorld.cpp @@ -194,30 +194,68 @@ void GameWorld::Initialize() //} - /*{ - auto gate = CreateEntity(); - auto transform = AddComponent(gate); - transform->Position = glm::vec3(0, -50, 100); - auto model = AddComponent(gate); - model->ModelFile = "Models/Flag/FishingRod/FishingRod.obj"; - + { + auto gateBase = CreateEntity(); + auto transform = AddComponent(gateBase); + transform->Position = glm::vec3(0, -50, 150); + auto model = AddComponent(gateBase); + model->ModelFile = "Models/Gate/Lift/Lift.obj"; + auto physics = AddComponent(gateBase); + physics->Static = true; + physics->CollisionLayer = 1; // Terrain-Layer { - //shape + auto leftBaseShape = CreateEntity(gateBase); + auto transform = AddComponent(leftBaseShape); + transform->Position = glm::vec3(8.5f, 3, 0); + auto box = AddComponent(leftBaseShape); + box->Width = 3.f/2; + box->Height = 6.094f/2; + box->Depth = 4.f/2; + CommitEntity(leftBaseShape); } - - { - auto fish = CreateEntity(flag); - auto transform = AddComponent(gate); - transform->Position = glm::vec3(-1.3f, 1.0, 0); - auto model = AddComponent(gate); - model->ModelFile = "Models/Flag/LeFish/Salmon.obj"; - CommitEntity(fish); + auto RightBaseShape = CreateEntity(gateBase); + auto transform = AddComponent(RightBaseShape); + transform->Position = glm::vec3(-8.5f, 3, 0); + auto box = AddComponent(RightBaseShape); + box->Width = 3.f/2; + box->Height = 6.094f/2; + box->Depth = 4.f/2; + CommitEntity(RightBaseShape); } - - CommitEntity(gate); - }*/ + { + auto LeftTopShape = CreateEntity(gateBase); + auto transform = AddComponent(LeftTopShape); + transform->Position = glm::vec3(7.5485f, 9.385f, 0); + auto box = AddComponent(LeftTopShape); + box->Width = 1.747f/2; + box->Height = 6.851f/2; + box->Depth = 1.767f/2; + CommitEntity(LeftTopShape); + } + { + auto RightTopShape = CreateEntity(gateBase); + auto transform = AddComponent(RightTopShape); + transform->Position = glm::vec3(-7.5485f, 9.385f, 0); + auto box = AddComponent(RightTopShape); + box->Width = 1.747f/2; + box->Height = 6.851f/2; + box->Depth = 1.767f/2; + CommitEntity(RightTopShape); + } + { + auto RampShape = CreateEntity(gateBase); + auto transform = AddComponent(RampShape); + transform->Position = glm::vec3(0, 0.24f, 0); + auto box = AddComponent(RampShape); + box->Width = 14.9f/2; + box->Height = 0.38f/2; + box->Depth = 1.484f/2; + CommitEntity(RampShape); + } + CommitEntity(gateBase); + } } diff --git a/src/Systems/PhysicsSystem.cpp b/src/Systems/PhysicsSystem.cpp index 13f136c..4d8b8ed 100644 --- a/src/Systems/PhysicsSystem.cpp +++ b/src/Systems/PhysicsSystem.cpp @@ -771,6 +771,9 @@ bool Systems::PhysicsSystem::OnSetVelocity( const Events::SetVelocity &event ) { m_PhysicsWorld->markForWrite(); m_RigidBodies[event.Entity]->setLinearVelocity(GLMVEC3_TO_HKVECTOR4(event.Velocity)); + + auto transformComponent = m_World->GetComponent(event.Entity); + transformComponent->Velocity = event.Velocity; m_PhysicsWorld->unmarkForWrite(); } return true; diff --git a/src/Systems/TriggerSystem.cpp b/src/Systems/TriggerSystem.cpp index 41ea333..166a509 100644 --- a/src/Systems/TriggerSystem.cpp +++ b/src/Systems/TriggerSystem.cpp @@ -82,7 +82,7 @@ void Systems::TriggerSystem::Flag( EntityID entity, EntityID phantomEntity ) m_World->RemoveComponent(phantomEntity); m_World->SetEntityParent(phantomEntity, entity); auto phantomTransform = m_World->GetComponent(phantomEntity); - phantomTransform->Position = glm::vec3(1.f, 0.1f, 2.f); + phantomTransform->Position = glm::vec3(-1.5f, 0.1f, 2.f); }