Added IceBrick and started to remove the scale dependency for physics bodies
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Blender MTL File: 'Bricks.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material.002
|
||||
Ns 96.078431
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd IceBrick_Diffuse.png
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
@@ -10,7 +10,7 @@ namespace Components
|
||||
|
||||
struct CircleShape : public Component
|
||||
{
|
||||
// Circles are circles
|
||||
float Radius = 1.f;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Components
|
||||
|
||||
struct RectangleShape : public Component
|
||||
{
|
||||
|
||||
glm::vec2 Dimensions = glm::vec2(1.f, 1.f);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -186,10 +186,11 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
|
||||
model->ModelFile = "Models/Test/Brick/Brick.obj";
|
||||
if ((line == 1 && row == 4) || (line == 3 && row == 2) || (line == 6 && row == 6)) {
|
||||
std::shared_ptr<Components::PowerUpBrick> cPow = m_World->AddComponent<Components::PowerUpBrick>(brick);
|
||||
model->ModelFile = "Models/Brick/IceBrick.obj";
|
||||
}
|
||||
float x = line * spacesBetweenBricks.x;
|
||||
float y = row * spacesBetweenBricks.y;
|
||||
transform->Scale = glm::vec3(0.8, 0.2, 0.2);
|
||||
//transform->Scale = glm::vec3(0.8, 0.2, 0.2);
|
||||
transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y , -10.f);
|
||||
cBrick->Score = 10 * num;
|
||||
|
||||
|
||||
@@ -252,20 +252,16 @@ void dd::Systems::PhysicsSystem::CreateBody(EntityID entity)
|
||||
|
||||
b2Shape* pShape;
|
||||
|
||||
auto boxComponent = m_World->GetComponent<Components::RectangleShape>(entity);
|
||||
if (boxComponent) {
|
||||
auto rectangleComponent = m_World->GetComponent<Components::RectangleShape>(entity);
|
||||
if (rectangleComponent) {
|
||||
b2PolygonShape* bShape = new b2PolygonShape();
|
||||
bShape->SetAsBox(absoluteTransform.Scale.x/2, absoluteTransform.Scale.y/2);
|
||||
bShape->SetAsBox(rectangleComponent->Dimensions.x/2.f, rectangleComponent->Dimensions.y/2.f);
|
||||
pShape = bShape;
|
||||
} else {
|
||||
auto circleComponent = m_World->GetComponent<Components::CircleShape>(entity);
|
||||
if (circleComponent) {
|
||||
pShape = new b2CircleShape();
|
||||
pShape->m_radius = absoluteTransform.Scale.x/2;
|
||||
|
||||
if (absoluteTransform.Scale.x != absoluteTransform.Scale.y && absoluteTransform.Scale.y != absoluteTransform.Scale.z) {
|
||||
LOG_WARNING("Circles has to be of uniform scale. xScale has been used for radius");
|
||||
}
|
||||
pShape->m_radius = circleComponent->Radius;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user