Commit graph

25 commits

Author SHA1 Message Date
ostermine
cb39ed464a use double precision for positions of entities and players
Transform::pos, Hitbox::position and Player::position were floats. At
65k blocks the float step is 8 mm, at 1M it is 6-12 cm, at 30M it is
2 m. The physics moves a body by 3 cm or less per substep and pushes it
out of a wall by 10 cm or less: steps got rounded to the grid (the body
changed its speed, then stopped), the AABB of a body was off by a float
step and gave false collisions with the blocks around.

Positions of bodies, entity transforms, players, spawn points and the
skeleton position interpolation are worldvec3 now. Collisions are still
calculated in floats, but in the coordinates relative to the block the
body is in: the solver takes the origin, block lookups and hitboxes of
other bodies are shifted by it, the result is added back in doubles.
So the precision of the physics is the same anywhere in the world.

A calculated sensor is stored relative to the position of its entity.
Entities::getAllInside takes the corners in doubles,
Entities::hasBlockingInside takes the origin of the AABB.

The save format does not change: positions are written as numbers
(float64) as before, saves are compatible in both directions. Lua
functions keep their signatures, they only stop rounding to float.
2026-11-12 10:05:07 +03:00
MihailRis
c73b036099 cleanup World references 2026-06-20 22:17:27 +03:00
MihailRis
c8e884009b fix extended blocks collision detection 2026-02-23 18:44:32 +03:00
MihailRis
b0d231c927 optimize collisions calculations (remove the stupid) 2026-02-18 18:54:49 +03:00
MihailRis
d708e8d21c cleanup 2025-12-16 00:45:15 +03:00
MihailRis
180dd5051b fix fatal error on invalid item id in inventory 2025-12-16 00:17:51 +03:00
MihailRis
c3c343ffdb update ContentUnitIndices 2025-12-15 22:05:27 +03:00
MihailRis
9dc9441902 reduce allocations while reading chunks data 2025-12-06 00:58:13 +03:00
MihailRis
e0b5c8457b fix corrupted voxel reset 2025-12-05 22:41:19 +03:00
MihailRis
5250c748be make chunk lightmap optional 2025-11-23 15:22:18 +03:00
MihailRis
1a6880a572 remove that thing 2025-11-18 20:46:24 +03:00
MihailRis
5317106d81 test chunks pool 2025-11-18 19:48:00 +03:00
MihailRis
922a86d2b0 add that thing 2025-11-18 18:41:21 +03:00
MihailRis
ca3bc45d0f add 'on_block_present' event 2025-11-17 23:50:52 +03:00
MihailRis
3eae377024 refactor Entities 2025-08-09 21:19:01 +03:00
clasher113
49727ec026
bug fix (#549)
* fix: pause menu on hudVisible=false

* add missing property

* reset controls fix
2025-07-14 18:45:47 +03:00
MihailRis
6ab48fda93 fix: entities despawn on F5 2025-07-14 18:20:10 +03:00
MihailRis
e5d558d357 move world-related sources from files/ to world/files 2025-01-30 15:02:28 +03:00
MihailRis
22c7cb8398 add on_chunk_present and on_chunk_remove events 2025-01-12 05:41:42 +03:00
MihailRis
c1b311f3c4 refactor: change pointer parameters to references for Level and Content in various classes 2024-12-25 18:53:53 +03:00
MihailRis
ed7dc1f901 feat: add app.save_world() function and update documentation 2024-12-25 15:15:11 +03:00
MihailRis
1c18c02092 move Chunks from Level to Player 2024-12-17 19:40:00 +03:00
MihailRis
87c19d69dc move block set logic to the blocks_agent 2024-12-16 20:46:06 +03:00
MihailRis
6157f8193d add blocks_agent templates & remove block.get_slow 2024-12-16 11:26:57 +03:00
MihailRis
e713412a6d rename ChunksStorage to GlobalChunks 2024-12-14 18:58:51 +03:00
Renamed from src/voxels/ChunksStorage.cpp (Browse further)