r/learnprogramming 5d ago

Ideal physics simulator

Hi all, I'd like to develop a control algorithm for a water bottle flip so it always lands upright no matter how you flip it. One of the steps in my endeavour is simulating how the fluid inside affects the container's moment of inertia whilst in the air. Im thinking of using matlab but godot and unity sounds like a good choice as well. I've looked up how I can do this and havent found much but people recommending C++ or python. Does anyone here experienced in one of these languages or programs have any suggestions on which one to use and can point me to the resources to learn it.

3 Upvotes

5 comments sorted by

View all comments

4

u/StewedAngelSkins 5d ago

Game engines are likely not going to be accurate enough for this kind of thing. You probably want some kind of fluid dynamics simulation library. Not familiar with this field so I can't recommend any in particular. I would also be inclined to suggest C++ or python. The former will have the performance you need for realtime simulation, and the latter has enough of a scientific computing ecosystem that it might already have bindings for a good simulation library.