Saturday, April 26, 2025
spot_img

javascript – Toxiclibs softbody physics problem with jittering below weight


hopefully that is alright to submit right here. I am studying to code and dealing on a factor (really making an attempt to breed this https://www.instagram.com/juhani.halkomaki/reel/DGFpqfCNgZe/ )

I’ve created a sketch in p5.js utilizing toxiclibs for physics in an try to get one thing comparable.

I am utilizing chains of particles and is derived to create my snakes, There aren’t any collisions so far as I can inform in toxiclibs, the particles have a sure radius with a unfavourable attraction utilized to them, to maintain them from going by way of the opposite snakes or themselves. This works nicely for essentially the most half and I just like the bouncy high quality of it.

However as extra snakes fall on high the snakes on the underside get squished up an excessive amount of, and ultimately the drive of the repulsion causes them to jitter. You possibly can see what I imply right here:

https://youtu.be/1pAg5O84iMo

about half approach by way of the video you may see the place I activate a visualisation for the drive strains, and the jittering particles flip backwards and forwards each body. I perceive this sort of jitter is a reasonably widespread downside however I do not know the best way to resolve it, I’ve tried lots of hacks and it finally ends up getting messy and by no means solves the issue. I am questioning if that is simply an inherent downside of utilizing springs and particles with repulsion between them and gravity. I am guessing collision detection would repair this, however there’s none accessible in toxicLibs.

Anyone obtained any ideas? Or recommendations for a way to do that identical kind of physics in matter.js or one thing else?



Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles