- Home /
How to make flowing water?
Is it possible to make flowing water? Let's say we have 2/3 water in a box container, then by the use of gyro of iPhone, when we turn the iphone around the water will also flow accordingly. Very much the same water simulation.
Answer by syclamoth · Sep 14, 2011 at 01:28 PM
Such a thing is not provided immediately with unity- you would have to write your own fluid simulation script. While there are a few fairly well documented algorithms for such a thing, it's really not straightforward, and you'd have to be really quite confident with code to want to try it. If you want a good start on the guiding principles and such, look here - http://en.wikipedia.org/wiki/Fluid_simulation.
Another thing is, its quite CPU-intensive at the best of times, which would make it not an ideal application for mobile devices!
Answer by msknapp · Sep 14, 2011 at 01:40 PM
You could try changing the material's texture offset with time for the object which has the water texture applied to it. The "Material" class has a public property called "mainTextureOffset" and a function called "SetTextureOffset". You could call these from an update function and set their value based on time. So it would look like it flows.
This would work up until the player tries to tip the water out of the container- at which point it will become obvious that it is just a flat plane.
Your answer
Follow this Question
Related Questions
Pro Water on the iPhone or Android - Runtime Reflect or Refract possible? 0 Answers
Flowing water in my voxel terrain 1 Answer
Underwater effect? 5 Answers
Water wave ripple effect for mobile - koi pond 2 Answers
Making 2D water? 1 Answer