31 lines
973 B
Markdown
31 lines
973 B
Markdown
{{{
|
|
"planted": "11/17/2020",
|
|
"repotted": "1/4/2026",
|
|
"nobreak": "true"
|
|
}}}
|
|
|
|
* Anyone up for a game of snake? wait a minute...
|
|
|
|
I made an implementation of FABRIK inverse kinematics in a #pico8 #tweetcart! (source in replies)
|
|
#tweetjam
|
|
|
|

|
|
|
|
<div class="code"><p>
|
|
poke(24365,1)x={}y={}z=16for i=0,32do
|
|
x[i]=0y[i]=0end::_::cls()for j=1,-1,-2do
|
|
for i=z-z*j+j,z+z*j,j do
|
|
a=x[i]-x[i-j]b=y[i]-y[i-j]l=(a*a+b*b)^.5a/=l
|
|
b/=l
|
|
x[i]=x[i-j]+a*4y[i]=y[i-j]+b*4end
|
|
end
|
|
for i=0,32do
|
|
circfill(x[i],y[i],2,i%8+8)end
|
|
x[0]=stat(32)y[0]=stat(33)flip()goto _
|
|
</p></div>
|
|
|
|
* This implementation was based on a great cart and writeup by [@2DArray](https://twitter.com/2DArray), which can be found here!
|
|
[https://lexaloffle.com/bbs/?pid=42900](https://lexaloffle.com/bbs/?pid=42900)
|
|
|
|
*gardener's note: I love the simplicity of this algorithm. It's really satisfying that such a complex problem can be approximated with such basic constraint solving.*
|
|
|