Devlog #19
Optimization and Interaction
I’ve optimized the triangle collision code to use the spatial partitioning I implemented before for collisions. It goes through each triangle and checks what balls are in its bounding box with the collision grid, and completely skips any balls that aren’t close. This allows for about a thousand balls in a scene (at least on my computer), which is a lot better than the hundred or so you’d get with just bounding box checks and the tens or so you would get with a naive approach. Sadly, this change is only on the XPBD branch for now, meaning it won’t reflect on the website, but you’d still probably have to be spawning balls for a while for that to slow down, depending on the computer.
I’ve also added far better interaction to the cloth, using some matrix multiplication and some raycast tests, you can now drag the cloth around with your mouse! This change was on the main branch too, so this is right on the website, right now!
I did try to implement a system for having the cloth tear when it was under stress, but it would have required me to rework a lot of stuff and it didn’t quite work out. :(
Comments 1
this look so realistic!
Sign in to join the conversation.