Hello! I was working on this water simulation that could be affected by tilting your phone, as if it were real water inside the phone! its a very simple test application, but i kept changing and changing the values and it…just never really worked correctly. Originally i was just gonna leave this in community or something, but I realized someone else might want to help me. I kept debugging until i ran out of builds… The project isnt complicated, so, ill simply tell you the way i do water simulation is with a physics object with a blue ball texture, and its hitbox with a radius slightly smaller than it, so it looks like they clump together. Change the friction, density, and gravity to 0, and reimplement the gravity with an angular force.
Thank you! and i hope someone can help me with this little project. Maybe i could even turn it into a really fun puzzle game.
I do not use marching squares for my fluid simulations due to performance issues. plus, that wasnt the problem, it was with properly configuring the gyroscope.
well…i plugged each axis that it gives me (e.g. DeviceSensors::OrientationGamma()) into the angular force, and none of them behaved correctly. for the correct behavior, hold your phone upright, and start turning it on its side. the liquid should fall with
In one of the games that im working on i wanted a room full of water sloshing about and with a shark in it. I did use marching squares but its a big room and I needed thousands of physics objects before it looked any good and it just uses too much processing. When the balls fall onto a platform and become isolated - they just look like balls and so I’m going to try today to have a go at creating an object that has a size based on what’s around it and not use physics2. It’ll probably not work…but i’ll give it a go anyway.
I just tried density and gravity at zero with a force at the angle of gravity and its fine. Have you got can be put to sleep checked? - as for me that was causing the less playful balls of water to just sit there looking pretty!
For what im doing marching squares and physics2 just adds too much processing. Having 200 balls with marching squares across the scene more than doubles processing
it goes from 1.99ms to 4.8ms
also, id prefer not to make an entire fluid simulation in gdevelop…its a 50/50 chance it either works great or is 100 times slower doing all of that processing. and just to be entirely clear, the problem is the math with the gravity, the water moves, just in the wrong directions.
i just tried doing a quick water simulation without physics2, using separate from to contain it inside the walls. there was a force between each object linked to distance between and radius and the radius changed based on what was around it but the force kept forcing the water to drain away and it performed badly - processing was 7ms. I havn’t tried linking the gravity direction to tilt yet.
Need to wait for keith to get back from work - I just tried linking the force to the Device sensor acceleration three different ways but i couldn’t get it to work and im sure ive used the same expression as keith.