diff --git a/include/Core/Engine.h b/include/Core/Engine.h index 21cada5..738349d 100644 --- a/include/Core/Engine.h +++ b/include/Core/Engine.h @@ -208,7 +208,7 @@ public: { auto t_waterBody = m_World->CreateEntity(); auto transform = m_World->AddComponent(t_waterBody); - transform->Position = glm::vec3(0.f, -4.5f, -10.f); + transform->Position = glm::vec3(0.f, -5.5f, -10.f); transform->Scale = glm::vec3(7.f, 1.5f, 1.f); auto water = m_World->AddComponent(t_waterBody); auto body = m_World->AddComponent(t_waterBody); diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index b6a8539..4130a78 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -281,9 +281,10 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event) Events::SetImpulse e; e.Entity = entityBrick; - glm::vec2 point = glm::vec2(transformComponentBrick->Position.x + ((transformComponentBrick->Position.x - transformComponentBall->Position.x)/4), transformComponentBrick->Position.y + ((transformComponentBrick->Position.y - transformComponentBall->Position.y )/4)); + glm::vec2 point = glm::vec2(transformComponentBrick->Position.x + ((transformComponentBall->Position.x - transformComponentBrick->Position.x )/4), + transformComponentBrick->Position.y + ((transformComponentBall->Position.y - transformComponentBrick->Position.y)/4)); - e.Impulse = glm::normalize(point)/2.f; + e.Impulse = glm::normalize(point)*5.f;///2.f; e.Point = point; EventBroker->Publish(e); //TODO: Bricks dont collide with walls D= diff --git a/src/game/Physics/PhysicsSystem.cpp b/src/game/Physics/PhysicsSystem.cpp index 2b5588b..7d23110 100644 --- a/src/game/Physics/PhysicsSystem.cpp +++ b/src/game/Physics/PhysicsSystem.cpp @@ -90,7 +90,7 @@ void dd::Systems::PhysicsSystem::Update(double dt) b2Vec2 position; position.x = transformComponent->Position.x; position.y = transformComponent->Position.y; - float angle = -glm::eulerAngles(transformComponent->Orientation).z; + float angle = glm::eulerAngles(transformComponent->Orientation).z; body->SetTransform(position, angle); body->SetLinearVelocity(b2Vec2(transformComponent->Velocity.x, transformComponent->Velocity.y)); body->SetGravityScale(physicsComponent->GravityScale); @@ -128,7 +128,7 @@ void dd::Systems::PhysicsSystem::Update(double dt) if (parent == 0) { auto physicsComponent = m_World->GetComponent(entity); - if (physicsComponent->Calculate) { + if (physicsComponent->Calculate) { //TODO: REPLACE THIS WITH PARTICLE COLLISION FILTERS transformComponent->Position.x = transformComponent->Position.x + (transformComponent->Velocity.x * m_TimeStep); transformComponent->Position.y = transformComponent->Position.y + (transformComponent->Velocity.y * m_TimeStep); } @@ -138,7 +138,7 @@ void dd::Systems::PhysicsSystem::Update(double dt) transformComponent->Position.y = position.y; float angle = body->GetAngle(); - transformComponent->Orientation = glm::quat(glm::vec3(0, 0, -angle)); + transformComponent->Orientation = glm::quat(glm::vec3(0, 0, angle)); b2Vec2 velocity = body->GetLinearVelocity(); transformComponent->Velocity.x = velocity.x; @@ -272,7 +272,7 @@ void dd::Systems::PhysicsSystem::CreateBody(EntityID entity) } else { fixtureDef.shape = pShape; - fixtureDef.density = 1.f; + fixtureDef.density = 10.f; fixtureDef.restitution = 1.0f; fixtureDef.friction = 0.0f; body->CreateFixture(&fixtureDef);