Sunday, June 15, 2025
HomeGame Developmentjavascript - Toxiclibs softbody physics subject with jittering beneath weight

javascript – Toxiclibs softbody physics subject with jittering beneath weight


hopefully that is alright to submit right here. I am studying to code and dealing on a factor (truly 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 related.

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

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

https://youtu.be/1pAg5O84iMo

about half method by way of the video you may see the place I activate a visualisation for the pressure traces, and the jittering particles flip backwards and forwards each body. I perceive this sort of jitter is a reasonably widespread downside however I don’t know the best way to resolve it, I’ve tried loads 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 out there in toxicLibs.

Anyone bought any suggestions? Or options for the way to do that similar sort of physics in matter.js or one thing else?



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments