feat: bigger characters (16 sub-bodies), wider terminal viewport
- Entity: 16 sub-bodies (was 7), radius 0.7 (was 0.4), full humanoid shape: head, shoulders, torso, arms, hips, legs, feet - Terminal: viewport up to 250x80 (was 120x50), uses full terminal size - Camera: uses renderer viewport dimensions instead of hardcoded values - Physics: constraint correction clamped to 0.5 cells max, 8 substeps (was 4), gravity 0.04 (was 0.08), collision pass after each constraint iteration to prevent tunneling with larger bodies - Player: move_speed 0.3, jump_force 1.2 for bigger body - Spawn: 6 cells above surface (was 4) for taller body
This commit is contained in:
+13
-6
@@ -94,11 +94,11 @@ pub struct VerletSolver {
|
||||
impl VerletSolver {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
gravity: 0.08,
|
||||
damping: 0.98,
|
||||
gravity: 0.04,
|
||||
damping: 0.97,
|
||||
dt: 1.0,
|
||||
max_vel: 0.8,
|
||||
substeps: 4,
|
||||
max_vel: 1.0,
|
||||
substeps: 8,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ impl VerletSolver {
|
||||
}
|
||||
|
||||
pub fn solve_constraints(&self, bodies: &mut [SubBody], constraints: &[Constraint], iterations: u32) {
|
||||
const MAX_CORRECTION: f32 = 0.5;
|
||||
for _ in 0..iterations {
|
||||
for c in constraints {
|
||||
let (ba, bb) = if c.a < bodies.len() && c.b < bodies.len() {
|
||||
@@ -143,8 +144,14 @@ impl VerletSolver {
|
||||
continue;
|
||||
}
|
||||
let diff = (dist - c.rest_length) / dist;
|
||||
let sx = dx * 0.5 * diff * c.stiffness;
|
||||
let sy = dy * 0.5 * diff * c.stiffness;
|
||||
let mut sx = dx * 0.5 * diff * c.stiffness;
|
||||
let mut sy = dy * 0.5 * diff * c.stiffness;
|
||||
let corr_mag = (sx * sx + sy * sy).sqrt();
|
||||
if corr_mag > MAX_CORRECTION {
|
||||
let scale = MAX_CORRECTION / corr_mag;
|
||||
sx *= scale;
|
||||
sy *= scale;
|
||||
}
|
||||
bodies[c.a].x += sx;
|
||||
bodies[c.a].y += sy;
|
||||
bodies[c.b].x -= sx;
|
||||
|
||||
Reference in New Issue
Block a user