x


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.

more ▼

asked Sep 14 '11 at 01:15 PM

Dreamer gravatar image

Dreamer
1.5k 39 49 66

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Sep 14 '11 at 01:28 PM

syclamoth gravatar image

syclamoth
14.8k 7 15 80

Another thing is, its quite CPU-intensive at the best of times, which would make it not an ideal application for mobile devices!

Sep 14 '11 at 01:29 PM syclamoth
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Sep 14 '11 at 01:40 PM

msknapp gravatar image

msknapp
181 7 9 11

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.

Sep 14 '11 at 01:43 PM syclamoth
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1999
x300
x3

asked: Sep 14 '11 at 01:15 PM

Seen: 2231 times

Last Updated: Sep 14 '11 at 01:43 PM