Water phyisics

This commit is contained in:
2026-10-07 19:38:27 -03:00
parent d101fa2ef3
commit 78117f65c9
13 changed files with 338 additions and 13 deletions
+8
View File
@@ -144,6 +144,14 @@ export class LocalPlayer extends Player {
this.gravity = this.flying ? 0 : !this.#in_water ? LAND_GRAVITY : this.swimming ? 0 : WATER_GRAVITY;
this.drag = this.flying ? FLY_VERTICAL_DRAG : this.#in_water ? WATER_DRAG : LAND_DRAG;
if (this.swimming && this.#in_water) this.#steer(input);
if (!this.flying) {
physics.push_by_liquid(
this,
(x, y, z) => this.level.liquid_at(x, y, z),
(x, y, z) => this.level.collision_shape(x, y, z),
true,
);
}
this.#prev_eye_height = this.eye_height;
const eye_height = this.swimming
? PLAYER_SWIM_EYE_HEIGHT