Compare commits

..

2 commits

4 changed files with 9 additions and 3 deletions

1
Cargo.lock generated
View file

@ -1333,6 +1333,7 @@ dependencies = [
"parking_lot 0.12.1", "parking_lot 0.12.1",
"stdweb", "stdweb",
"thiserror", "thiserror",
"wasm-bindgen",
"web-sys", "web-sys",
"windows", "windows",
] ]

View file

@ -24,6 +24,7 @@ serde_json = "1.0.85"
ticktock = "0.8.0" ticktock = "0.8.0"
[target."cfg(target_arch = \"wasm32\")".dependencies] [target."cfg(target_arch = \"wasm32\")".dependencies]
cpal = { version = "0.14.0", features = ["wasm-bindgen"] }
[profile.dev.package."*"] [profile.dev.package."*"]
opt-level = 3 opt-level = 3

2
run-wasm.sh Normal file
View file

@ -0,0 +1,2 @@
source build-wasm.sh
python -m http.server

View file

@ -471,13 +471,15 @@ fn move_camera(
let size: Vec2 = camera.logical_viewport_size().unwrap(); let size: Vec2 = camera.logical_viewport_size().unwrap();
let half_height: f32 = size.y * 0.5; let half_height: f32 = size.y * 0.5;
let mut target_translation = character_transform.translation;
// prevent camera from going too low
target_translation.y = target_translation.y.max(half_height - MARGIN);
camera_transform.translation = camera_transform.translation.lerp( camera_transform.translation = camera_transform.translation.lerp(
character_transform.translation, target_translation,
time.delta_seconds() * FOLLOW_SPEED, time.delta_seconds() * FOLLOW_SPEED,
); );
// prevent camera from going too low
camera_transform.translation.y = camera_transform.translation.y.max(half_height - MARGIN);
// always make sure that camera is away from the object in order to render them // always make sure that camera is away from the object in order to render them
camera_transform.translation.z = 999.0; camera_transform.translation.z = 999.0;
} }