Skip to content

Commit a7de496

Browse files
committed
fixing normalized positions again.
1 parent bf88442 commit a7de496

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hallway-study/app.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,11 @@ function serializePerson(person) {
608608
const xvel = person.xVelocity || 0;
609609
const yvel = person.isDwelling ? 0 : (person.speed * person.direction);
610610

611-
// Normalize positions to 0-1 range
611+
// Normalize positions to 0-1 range within floor plane
612612
// x = blue axis (Z in Three.js) = hallway length
613613
// y = red axis (X in Three.js) = hallway width
614-
const xNormalized = Math.max(0, Math.min(1, (person.z + hallway.length_m * 0.5) / hallway.length_m));
614+
// Note: person.z ranges [0, length_m], person.xOffset ranges [-width_m/2, +width_m/2]
615+
const xNormalized = Math.max(0, Math.min(1, person.z / hallway.length_m));
615616
const yNormalized = Math.max(0, Math.min(1, (person.xOffset + hallway.width_m * 0.5) / hallway.width_m));
616617

617618
return {

0 commit comments

Comments
 (0)