Commit graph

7 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
9846ad289a feat: entity rotation interpolation 2026-10-26 19:30:53 +03:00
MihailRis
a7ffbc9dec add more debug messages and checks 2026-02-02 19:54:24 +03:00
MihailRis
f1d85000e4 add transform vectors/matrices nan/inf check 2026-02-02 19:38:43 +03:00
MihailRis
d435cbab5c
Adapt windows build to glm 1.0.2 (#655)
* update Shadows.cpp

* add glm includes to Shadows.cpp

* add includes
2025-10-17 13:03:58 +03:00
MihailRis
5583734bc2 refactor 2025-08-09 22:43:06 +03:00
MihailRis
3eae377024 refactor Entities 2025-08-09 21:19:01 +03:00