diff options
| author | untodesu <kirill@untode.su> | 2026-01-05 02:41:34 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2026-01-05 02:41:34 +0500 |
| commit | 415e6c8d3f19583aca1fc2b606ac32e317024630 (patch) | |
| tree | 994fc00939910f78c176f9415e8bba51f670d854 /src/game | |
| parent | 915e52157208af9b41dd52892e7138c8c440e85b (diff) | |
| download | voxelius-415e6c8d3f19583aca1fc2b606ac32e317024630.tar.bz2 voxelius-415e6c8d3f19583aca1fc2b606ac32e317024630.zip | |
Keep trying to figure collision out
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/entity/camera.cc | 2 | ||||
| -rw-r--r-- | src/game/client/game.cc | 2 | ||||
| -rw-r--r-- | src/game/client/toggles.cc | 2 | ||||
| -rw-r--r-- | src/game/shared/entity/collision.cc | 6 |
4 files changed, 7 insertions, 5 deletions
diff --git a/src/game/client/entity/camera.cc b/src/game/client/entity/camera.cc index 8cd08fd..ac8ded9 100644 --- a/src/game/client/entity/camera.cc +++ b/src/game/client/entity/camera.cc @@ -104,7 +104,7 @@ void camera::update(void) auto client_angles = camera::angles; - if(!toggles::get(TOGGLE_PM_FLIGHT) && globals::dimension->entities.try_get<Grounded>(globals::player)) { + if(!toggles::get(TOGGLE_PM_FLIGHT)) { client_angles[2] = math::radians(-camera::roll_angle.get_value() * glm::dot(velocity.value / PMOVE_MAX_SPEED_GROUND, right_vector)); } diff --git a/src/game/client/game.cc b/src/game/client/game.cc index 9b55b4b..9a2cb56 100644 --- a/src/game/client/game.cc +++ b/src/game/client/game.cc @@ -613,7 +613,7 @@ void client_game::render(void) for(const auto [entity, collision, head, transform] : group.each()) { if(entity == globals::player) { // Don't render ourselves - // continue; + continue; } glm::fvec3 forward; diff --git a/src/game/client/toggles.cc b/src/game/client/toggles.cc index 1b46960..0ad7a27 100644 --- a/src/game/client/toggles.cc +++ b/src/game/client/toggles.cc @@ -106,7 +106,7 @@ void toggles::init(void) toggle_infos[TOGGLE_CHUNK_AABB].description = "chunk Borders"; toggle_infos[TOGGLE_CHUNK_AABB].glfw_keycode = GLFW_KEY_G; - toggle_infos[TOGGLE_CHUNK_AABB].is_enabled = true; + toggle_infos[TOGGLE_CHUNK_AABB].is_enabled = false; toggle_infos[TOGGLE_METRICS_UI].description = std::string_view(); toggle_infos[TOGGLE_METRICS_UI].glfw_keycode = GLFW_KEY_V; diff --git a/src/game/shared/entity/collision.cc b/src/game/shared/entity/collision.cc index 2c14a34..64b0455 100644 --- a/src/game/shared/entity/collision.cc +++ b/src/game/shared/entity/collision.cc @@ -20,7 +20,7 @@ #include "shared/coord.hh" #include "shared/globals.hh" -constexpr static float AABB_EPSILON = 1.0f / 32.0f; +constexpr static float AABB_EPSILON = 1.0f / 128.0f; static int vgrid_collide(const Dimension* dimension, int d, Collision& collision, Transform& transform, Velocity& velocity, VoxelMaterial& touch_surface, bool enable_snapping) @@ -74,6 +74,7 @@ static int vgrid_collide(const Dimension* dimension, int d, Collision& collision auto closest_touch = VTOUCH_NONE; auto closest_surface = VMAT_UNKNOWN; auto closest_tvalues = ZERO_VEC3<float>; + auto closest_doubleclip = false; math::AABBf closest_vbox; for(auto i = dmin; i != dmax; i += ddir) { @@ -109,6 +110,7 @@ static int vgrid_collide(const Dimension* dimension, int d, Collision& collision closest_touch = voxel->get_touch_type(); closest_surface = voxel->get_surface_material(); closest_tvalues = voxel->get_touch_values(); + closest_doubleclip = csg_aabb.intersect(vbox); closest_vbox = vbox; } } @@ -146,7 +148,7 @@ static int vgrid_collide(const Dimension* dimension, int d, Collision& collision snap_to_closest_vbox = true; } - if(snap_to_closest_vbox && enable_snapping) { + if(snap_to_closest_vbox && enable_snapping && closest_doubleclip) { auto vbox_center = 0.5f * closest_vbox.min[d] + 0.5f * closest_vbox.max[d]; auto vbox_halfsize = 0.5f * closest_vbox.max[d] - 0.5f * closest_vbox.min[d]; |
