Water phyisics
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user