Smooth camera and unit motion: display positions, camera target smoothing, pan speed setting

This commit is contained in:
Richard Zink committed 2026-11-04 13:56:11 +01:00
1 parent 583c3fcdaf
commit eb11cca8cb
10 files changed
+107 -23

No files matched your search

+3 -3
View File
@@ -165,15 +165,15 @@ pub fn draw_props_solid(g: &Game, cam: &Cam, t: f32) {
}
// creatures in chains: an iron post with chains to the creature
for e in g.ents.iter().filter(|e| e.alive && e.chained) {
if (e.x as i32) < x0 || (e.x as i32) > x1 || (e.y as i32) < z0 || (e.y as i32) > z1 {
if (e.disp_x as i32) < x0 || (e.disp_x as i32) > x1 || (e.disp_y as i32) < z0 || (e.disp_y as i32) > z1 {
continue;
}
let post = vec3(e.x.floor() + 0.5, 0.0, e.y.floor() + 0.15);
let post = vec3(e.disp_x.floor() + 0.5, 0.0, e.disp_y.floor() + 0.15);
cube(post + vec3(0.0, 0.35, 0.0), vec3(0.08, 0.7, 0.08), rgb(70, 70, 78, 0.6));
for n in 0..6 {
let f = n as f32 / 6.0;
let side = if n % 2 == 0 { 0.08 } else { -0.08 };
let p = post.lerp(vec3(e.x + side, 0.25, e.y), f) + vec3(0.0, 0.3 * (1.0 - f) + 0.05 * (f * 3.14).sin(), 0.0);
let p = post.lerp(vec3(e.disp_x + side, 0.25, e.disp_y), f) + vec3(0.0, 0.3 * (1.0 - f) + 0.05 * (f * 3.14).sin(), 0.0);
cube(p, vec3(0.05, 0.05, 0.05), rgb(120, 120, 130, 0.6));
}
}