Commit fcfdbc4
Fix branch growth force to pull toward force.direction as a world axis
The old rotateTowards(qForce, step) form was degenerate when
force.direction equalled the section's natural growth direction
(e.g. (0,1,0) on a vertical trunk): qForce collapsed to identity,
and with negative strength the slerp extrapolated along whatever
tiny tilt the section had drifted into — pushing branches in random
seed-dependent directions instead of toward -force.direction.
Rotate directly around the (sectionUp × force.direction) axis so
force.direction is a real world axis: positive strength pulls
toward it, negative pushes away, and the rotation is zero exactly
when growth is already aligned with the target.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 28c1650 commit fcfdbc4
2 files changed
Lines changed: 27 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | 209 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
219 | 233 | | |
220 | 234 | | |
221 | 235 | | |
| |||
0 commit comments