6

# Flexible Softbodies in PICO-8

Hello everyone! I've been using PICO-8 for a while now, but this is my first post on the BBS, and I'd like to share some of the shenanigans I'm doing.
About a year ago, I stumbled upon Walaber's video on how he made Jellycar's physics (https://www.youtube.com/watch?v=3OmkehAJoyo&ab_channel=WalaberEntertainment) and I thought it was really cool. I also thought It'd be fun to make a softbody system for myself. So I tried and was able to do some fun things with springs and a bit of collision. I had learned a bit about dot and cross products that year in math classes I took, so it was cool to use the stuff I just learned to make a fun program. Up to this point all the softbodies were just springs connected to each other.

Then, I tried to implement shape matching (where you link the physical polygon to an invisible "frame" that in turn updates its rotation to the physical polygon's) and everything went downhill.

After that I kind of gave up after trying some more methods of measuring the angle of a soft deformable shape, but nothing worked. At that point I felt kind of silly since it seemed like I was 90% done, but couldn't finish the last part. So I quit, and then came back to it a few months ago.
This time, I cheated and asked ChatGPT how to measure the angle of a polygon relative to its initial rotation. It gave me the little bit of vector math I couldn't figure out myself. I implemented it and it worked!! Go figure.

After that, I tried adding in collisions, but they still weren't very stable - as you can see above - just like last time. (not sure how to get those to work perfect yet). Friction with other bodies is something I'm going to work on as well. I intend to make a game out of this someday, but for now, I'll just put the cartridge here for you all to play with yourself. Use the mouse & press X to move the shape around. There are instructions in its code if you want to make more shapes.

Cart #cs64_softbodies-0 | 2024-04-02 | Code ▽ | License: CC4-BY-NC-SA
6

P#145419 2024-04-02 01:14

wow, it looks so cool!

P#145426 2024-04-02 02:28