Commit b70d11a4 authored by Kevin Balz's avatar Kevin Balz
Browse files

Merge branch 'develop' into feature/8-beat-detection

parents 1296e68c f8a2378d
Pipeline #3293 passed with stage
in 3 minutes and 54 seconds
......@@ -87,14 +87,15 @@ namespace phase_shifter::gameplay {
auto offset = -move.last_step * t0 + move.last_step * t1;
auto pos = glm::vec2(transform.position.x, transform.position.z);
auto entity_handle = entity.handle();
entity.process([&](Rigid_body_comp& body) {
_level_system.check_contacts(pos + offset, body.radius, [&](util::Contact contact) {
if(contact.distance2 <= 0.0001f) {
offset = glm::vec2(0, 0);
_bus.send<Entity_hit_wall>(entity.handle());
_bus.send<Entity_hit_wall>(entity_handle);
} else if(auto normal_vel = glm::dot(offset, contact.normal); normal_vel > 0) {
offset -= normal_vel * contact.normal;
_bus.send<Entity_hit_wall>(entity.handle());
_bus.send<Entity_hit_wall>(entity_handle);
}
});
});
......
......@@ -125,19 +125,19 @@ namespace phase_shifter::level {
auto min_x = std::clamp(
static_cast<std::size_t>(std::floor(origin.x / tile_size - radius / tile_size - 0.5f)),
(std::size_t) 0,
static_cast<std::size_t>(0),
level_size_x - 1);
auto min_y = std::clamp(
static_cast<std::size_t>(std::floor(origin.y / tile_size - radius / tile_size - 0.5f)),
(std::size_t) 0,
static_cast<std::size_t>(0),
level_size_y - 1);
auto max_x = std::clamp(
static_cast<std::size_t>(std::ceil(origin.x / tile_size + radius / tile_size + 0.5f)),
(std::size_t) 0,
static_cast<std::size_t>(0),
level_size_x - 1);
auto max_y = std::clamp(
static_cast<std::size_t>(std::ceil(origin.y / tile_size + radius / tile_size + 0.5f)),
(std::size_t) 0,
static_cast<std::size_t>(0),
level_size_y - 1);
for(auto y = min_y; y <= max_y; y++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment