Expand voxel gameplay, lighting, full-height streaming and world imports
MVP checks / mvp (push) Canceled after 0s
MVP checks / mvp (push) Canceled after 0s
Add shared Rust/WASM physics, worker meshing and diagnostics, 64-chunk full-height streaming, atlas texture support, and baseline world import. Document the current implementation and include the supplied in-game lobby screenshot.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/** Separate the last server pose from the pose currently drawn on screen. */
|
||||
export function updateRemotePlayer(previous, packet, instant = false) {
|
||||
const preserve = previous && !instant;
|
||||
const targetYaw = packet.yaw ?? 0;
|
||||
return {
|
||||
...packet,
|
||||
position: preserve ? previous.position : [...packet.position],
|
||||
target: [...packet.position],
|
||||
yaw: preserve ? previous.yaw : targetYaw,
|
||||
targetYaw,
|
||||
};
|
||||
}
|
||||
|
||||
export function smoothRemotePlayer(player, blend) {
|
||||
for (let axis = 0; axis < 3; axis++)
|
||||
player.position[axis] +=
|
||||
(player.target[axis] - player.position[axis]) * blend;
|
||||
// Follow the shortest arc, including when server angles cross ±π or 2π.
|
||||
const delta = player.targetYaw - player.yaw;
|
||||
player.yaw += Math.atan2(Math.sin(delta), Math.cos(delta)) * blend;
|
||||
}
|
||||
Reference in New Issue
Block a user