ludic.nav (18.5): a walker the crowd avoids and never moves
nav_crowd_add_fixed adds a walker with no steering, and nav_crowd_place puts it (snapped to the mesh) where the player is, with the velocity they have, each frame. The others plan round it by that velocity, and whatever it was pushed by is undone at the next placement. crowd_test: six walkers aimed through a standing player come no closer than 1.71 m and all get past, and the player stays where it was put. nav 16/16 on the Mac and the PC; DLL KERNEL32 only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d83eabfdf1
commit
074189b73e
8 changed files with 93 additions and 7 deletions
|
|
@ -27,6 +27,17 @@ export function nav_crowd_add(nav_st: NavState, kind: int, x: float, y: float, z
|
|||
if c == null { return -1 }
|
||||
return nvc_crowd_add(c, x, y, z, radius, height, speed, filter, separation)
|
||||
}
|
||||
# a walker the crowd avoids but never moves (a player): put where it is each frame with nav_crowd_place
|
||||
export function nav_crowd_add_fixed(nav_st: NavState, kind: int, x: float, y: float, z: float, radius: float, height: float) -> int {
|
||||
let c = nv_crowd(nav_st, kind)
|
||||
if c == null { return -1 }
|
||||
return nvc_crowd_add_fixed(c, x, y, z, radius, height)
|
||||
}
|
||||
# walker i put at (x, y, z) going (vx, vz); false off the mesh
|
||||
export function nav_crowd_place(nav_st: NavState, kind: int, i: int, x: float, y: float, z: float, vx: float, vz: float) -> bool {
|
||||
let c = nv_crowd(nav_st, kind)
|
||||
return c != null and i >= 0 and nvc_crowd_place(c, i, x, y, z, vx, vz) == 1
|
||||
}
|
||||
export function nav_crowd_remove(nav_st: NavState, kind: int, i: int) -> void {
|
||||
let c = nv_crowd(nav_st, kind)
|
||||
if c != null and i >= 0 { nvc_crowd_remove(c, i) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue