Gate half done
This commit is contained in:
+57
-19
@@ -194,30 +194,68 @@ void GameWorld::Initialize()
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
/*{
|
{
|
||||||
auto gate = CreateEntity();
|
auto gateBase = CreateEntity();
|
||||||
auto transform = AddComponent<Components::Transform>(gate);
|
auto transform = AddComponent<Components::Transform>(gateBase);
|
||||||
transform->Position = glm::vec3(0, -50, 100);
|
transform->Position = glm::vec3(0, -50, 150);
|
||||||
auto model = AddComponent<Components::Model>(gate);
|
auto model = AddComponent<Components::Model>(gateBase);
|
||||||
model->ModelFile = "Models/Flag/FishingRod/FishingRod.obj";
|
model->ModelFile = "Models/Gate/Lift/Lift.obj";
|
||||||
|
|
||||||
|
|
||||||
|
auto physics = AddComponent<Components::Physics>(gateBase);
|
||||||
|
physics->Static = true;
|
||||||
|
physics->CollisionLayer = 1; // Terrain-Layer
|
||||||
{
|
{
|
||||||
//shape
|
auto leftBaseShape = CreateEntity(gateBase);
|
||||||
|
auto transform = AddComponent<Components::Transform>(leftBaseShape);
|
||||||
|
transform->Position = glm::vec3(8.5f, 3, 0);
|
||||||
|
auto box = AddComponent<Components::BoxShape>(leftBaseShape);
|
||||||
|
box->Width = 3.f/2;
|
||||||
|
box->Height = 6.094f/2;
|
||||||
|
box->Depth = 4.f/2;
|
||||||
|
CommitEntity(leftBaseShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto fish = CreateEntity(flag);
|
auto RightBaseShape = CreateEntity(gateBase);
|
||||||
auto transform = AddComponent<Components::Transform>(gate);
|
auto transform = AddComponent<Components::Transform>(RightBaseShape);
|
||||||
transform->Position = glm::vec3(-1.3f, 1.0, 0);
|
transform->Position = glm::vec3(-8.5f, 3, 0);
|
||||||
auto model = AddComponent<Components::Model>(gate);
|
auto box = AddComponent<Components::BoxShape>(RightBaseShape);
|
||||||
model->ModelFile = "Models/Flag/LeFish/Salmon.obj";
|
box->Width = 3.f/2;
|
||||||
CommitEntity(fish);
|
box->Height = 6.094f/2;
|
||||||
|
box->Depth = 4.f/2;
|
||||||
|
CommitEntity(RightBaseShape);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
CommitEntity(gate);
|
auto LeftTopShape = CreateEntity(gateBase);
|
||||||
}*/
|
auto transform = AddComponent<Components::Transform>(LeftTopShape);
|
||||||
|
transform->Position = glm::vec3(7.5485f, 9.385f, 0);
|
||||||
|
auto box = AddComponent<Components::BoxShape>(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<Components::Transform>(RightTopShape);
|
||||||
|
transform->Position = glm::vec3(-7.5485f, 9.385f, 0);
|
||||||
|
auto box = AddComponent<Components::BoxShape>(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<Components::Transform>(RampShape);
|
||||||
|
transform->Position = glm::vec3(0, 0.24f, 0);
|
||||||
|
auto box = AddComponent<Components::BoxShape>(RampShape);
|
||||||
|
box->Width = 14.9f/2;
|
||||||
|
box->Height = 0.38f/2;
|
||||||
|
box->Depth = 1.484f/2;
|
||||||
|
CommitEntity(RampShape);
|
||||||
|
}
|
||||||
|
CommitEntity(gateBase);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -771,6 +771,9 @@ bool Systems::PhysicsSystem::OnSetVelocity( const Events::SetVelocity &event )
|
|||||||
{
|
{
|
||||||
m_PhysicsWorld->markForWrite();
|
m_PhysicsWorld->markForWrite();
|
||||||
m_RigidBodies[event.Entity]->setLinearVelocity(GLMVEC3_TO_HKVECTOR4(event.Velocity));
|
m_RigidBodies[event.Entity]->setLinearVelocity(GLMVEC3_TO_HKVECTOR4(event.Velocity));
|
||||||
|
|
||||||
|
auto transformComponent = m_World->GetComponent<Components::Transform>(event.Entity);
|
||||||
|
transformComponent->Velocity = event.Velocity;
|
||||||
m_PhysicsWorld->unmarkForWrite();
|
m_PhysicsWorld->unmarkForWrite();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void Systems::TriggerSystem::Flag( EntityID entity, EntityID phantomEntity )
|
|||||||
m_World->RemoveComponent<Components::Trigger>(phantomEntity);
|
m_World->RemoveComponent<Components::Trigger>(phantomEntity);
|
||||||
m_World->SetEntityParent(phantomEntity, entity);
|
m_World->SetEntityParent(phantomEntity, entity);
|
||||||
auto phantomTransform = m_World->GetComponent<Components::Transform>(phantomEntity);
|
auto phantomTransform = m_World->GetComponent<Components::Transform>(phantomEntity);
|
||||||
phantomTransform->Position = glm::vec3(1.f, 0.1f, 2.f);
|
phantomTransform->Position = glm::vec3(-1.5f, 0.1f, 2.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user