Failed Gyroscope Water Simulation

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 don’t know if this will help but there’s a water (liquid effects) demo using the Marching Squares extension. It uses touch.

https://wiki.gdevelop.io/gdevelop5/extensions/marching-squares/details/

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.

I’m just trying to give you options and an example to maybe learn something from.

How were you using the gyroscope? If you post a screenshot(s) of your events people might be able to help.

1 Like

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 tried playing with the Marching Squares example and it works. My axis were off. The tilting left and right was backwards but it worked.

All I did was add…

I don’t know which sensor to use.

1 Like

I wondered whether it was having density at zero is causing problems

what do you mean by that?

i seem to remember density at zero causes issues …ill test it out

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


My balls are this big and i think its decent enough, the most important thing is flow, which…isnt good, they kinda sit on top of eachother

i shouldve read that before i send it

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.

Could someone send a gd.games link? I’d love to test this out with my phone…but I think I’ll pass spinning my computer :laughing:

I don’t think there is a link, it’s just various people trying things but very sadly there has been no gifs yet.

Or.
You also join in and try to make it! I might give it a go in my own way.

2 Likes

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.

I’m no expert on the sensors. Did you activate the sensors?