feat(wildlife): 17.5 - an animal walks by the world's way where it has one: WildlifeWorld.way (the next corner toward where it is going, asked every half second or on reaching it) steers wandering and going to water or forage, and goal (a spot it can reach) is a wander's target, seeded by the same two draws so the dice do not move; the defaults are the straight line and the old target. way_test: round a wall by its corners, and a wander's target where the world says
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
537d3a0ab3
commit
4add35b4ca
9 changed files with 168 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# steer.ludic - turning toward a point at a rate, a step along the facing that turns away from water
|
||||
# and a climb, and a target somewhere about home; a walker leaves a print every 2.8 m
|
||||
# and a climb; a walker leaves a print every 2.8 m (the way there and a target about home: way.ludic)
|
||||
function wl_wrap(a: float) -> float {
|
||||
var r = a
|
||||
while r > 3.1415927 { r = r - WL_TAU }
|
||||
|
|
@ -58,13 +58,6 @@ function wl_push(wildlife_st: mut WildlifeState, a: WildAnimal, s: WildSpecies,
|
|||
return hit
|
||||
}
|
||||
|
||||
function wl_pick_target(wildlife_st: WildlifeState, a: WildAnimal, radius: float) -> void {
|
||||
let ang = wl_rnd(wildlife_st) * WL_TAU
|
||||
let d = wl_rnd(wildlife_st) * radius
|
||||
a.tx = a.home_x + Math.cos(ang) * d
|
||||
a.tz = a.home_z + Math.sin(ang) * d
|
||||
}
|
||||
|
||||
function wl_at_target(a: WildAnimal, r: float) -> bool {
|
||||
let dx = a.tx - a.x
|
||||
let dz = a.tz - a.z
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue