PhysicsSystem redesigned, more work is needed.

This commit is contained in:
ViktorLjung
2014-05-07 16:21:47 +02:00
parent dc32316bd7
commit ea69a9345d
9 changed files with 325 additions and 194 deletions
+29 -17
View File
@@ -22,14 +22,20 @@ void GameWorld::Initialize()
auto model = AddComponent<Components::Model>(ground, "Model");
//model->ModelFile = "Models/TestScene/testScene.obj";
model->ModelFile = "Models/Placeholders/Terrain/Terrain.obj";
auto meshShape = AddComponent<Components::MeshShape>(ground, "MeshShape");
meshShape->ResourceName = "Models/Placeholders/Terrain/Terrain.obj";
//meshShape->ResourceName = "Models/TestScene/testScene.obj";
auto physics = AddComponent<Components::Physics>(ground, "Physics");
physics->Mass = 10;
physics->Static = true;
auto groundshape = CreateEntity(ground);
auto transformshape = AddComponent<Components::Transform>(groundshape, "Transform");
auto meshShape = AddComponent<Components::MeshShape>(groundshape, "MeshShape");
meshShape->ResourceName = "Models/Placeholders/Terrain/Terrain.obj";
//meshShape->ResourceName = "Models/TestScene/testScene.obj";
CommitEntity(groundshape);
CommitEntity(ground);
}
@@ -49,11 +55,10 @@ void GameWorld::Initialize()
{
auto jeep = CreateEntity();
auto transform = AddComponent<Components::Transform>(jeep, "Transform");
transform->Position = glm::vec3(0, 15, 0);
transform->Position = glm::vec3(0, 5, 0);
transform->Orientation = glm::angleAxis(glm::pi<float>()/2, glm::vec3(0, 1, 0));
auto physics = AddComponent<Components::Physics>(jeep, "Physics");
physics->Mass = 800;
physics->Mass = 1800;
// auto box = AddComponent<Components::Box>(jeep, "Box");
// box->Width = 1.487f;
@@ -61,7 +66,7 @@ void GameWorld::Initialize()
// box->Depth = 2.594f;
auto meshShape = AddComponent<Components::MeshShape>(jeep, "MeshShape");
meshShape->ResourceName = "Models/JeepV2/Chassi/ChassiCollision.obj";
meshShape->ResourceName = "Models/Jeep/Chassi/ChassiCollision.obj";
auto vehicle = AddComponent<Components::Vehicle>(jeep, "Vehicle");
@@ -72,7 +77,7 @@ void GameWorld::Initialize()
auto transform = AddComponent<Components::Transform>(chassis, "Transform");
transform->Position = glm::vec3(0, 0, 0); // 0.6577f
auto model = AddComponent<Components::Model>(chassis, "Model");
model->ModelFile = "Models/JeepV2/Chassi/ChassiCollision.obj";
model->ModelFile = "Models/Jeep/Chassi/chassi.obj";
}
{
@@ -98,7 +103,7 @@ void GameWorld::Initialize()
transform->Position = glm::vec3(1.9f, 0.5546f - wheelOffset, -0.9242f);
transform->Scale = glm::vec3(1.0f);
auto model = AddComponent<Components::Model>(wheel, "Model");
model->ModelFile = "Models/JeepV2/WheelFront/wheelFront.obj";
model->ModelFile = "Models/Jeep/WheelFront/wheelFront.obj";
auto Wheel = AddComponent<Components::Wheel>(wheel, "Wheel");
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
Wheel->AxleID = 0;
@@ -118,7 +123,7 @@ void GameWorld::Initialize()
transform->Scale = glm::vec3(1.0f);
transform->Orientation = glm::angleAxis(glm::pi<float>(), glm::vec3(0, 0, 1));
auto model = AddComponent<Components::Model>(wheel, "Model");
model->ModelFile = "Models/JeepV2/WheelFront/wheelFront.obj";
model->ModelFile = "Models/Jeep/WheelFront/wheelFront.obj";
auto Wheel = AddComponent<Components::Wheel>(wheel, "Wheel");
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
Wheel->AxleID = 0;
@@ -136,7 +141,7 @@ void GameWorld::Initialize()
auto transform = AddComponent<Components::Transform>(wheel, "Transform");
transform->Position = glm::vec3(0.2726f, 0.2805f - wheelOffset, 1.9307f);
auto model = AddComponent<Components::Model>(wheel, "Model");
model->ModelFile = "Models/JeepV2/WheelBack/wheelBack.obj";
model->ModelFile = "Models/Jeep/WheelBack/wheelBack.obj";
auto Wheel = AddComponent<Components::Wheel>(wheel, "Wheel");
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
Wheel->AxleID = 1;
@@ -155,7 +160,7 @@ void GameWorld::Initialize()
transform->Position = glm::vec3(-0.2726f, 0.2805f - wheelOffset, 1.9307f);
transform->Orientation = glm::angleAxis(glm::pi<float>(), glm::vec3(0, 0, 1));
auto model = AddComponent<Components::Model>(wheel, "Model");
model->ModelFile = "Models/JeepV2/WheelBack/wheelBack.obj";
model->ModelFile = "Models/Jeep/WheelBack/wheelBack.obj";
auto Wheel = AddComponent<Components::Wheel>(wheel, "Wheel");
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
Wheel->AxleID = 1;
@@ -167,6 +172,7 @@ void GameWorld::Initialize()
Wheel->ConnectedToHandbrake = true;
CommitEntity(wheel);
}
CommitEntity(jeep);
}
@@ -194,7 +200,7 @@ void GameWorld::Initialize()
CommitEntity(entity);
}*/
for(int i = 0; i < 5; i++)
for(int i = 0; i < 1; i++)
{
auto wall = CreateEntity();
auto transform = AddComponent<Components::Transform>(wall, "Transform");
@@ -205,7 +211,7 @@ void GameWorld::Initialize()
{
for (int x = -5; x < 5; x++)
{
auto brick = CreateEntity(wall);
auto brick = CreateEntity();
auto transform = AddComponent<Components::Transform>(brick, "Transform");
transform->Position = glm::vec3(x + 0.01f, y * 0.3f + 0.01f, 0);
transform->Position.x += (y % 2)*0.5f;
@@ -216,10 +222,16 @@ void GameWorld::Initialize()
auto physics = AddComponent<Components::Physics>(brick, "Physics");
physics->Mass = 3;
auto box = AddComponent<Components::BoxShape>(brick, "BoxShape");
auto shape = CreateEntity(brick);
auto transformshape = AddComponent<Components::Transform>(shape, "Transform");
auto box = AddComponent<Components::BoxShape>(shape, "BoxShape");
box->Width = 0.5f;
box->Height = 0.15f;
box->Depth = 0.3f;
CommitEntity(shape);
CommitEntity(brick);
}
}