Question

For this simulation, I have two objects:

  1. Rectangle bucket sprite.
  2. Rectangle animated water sprite.

Of course, by only manipulating the vertices of these two sprites, I don't expect a too realistic water spill simulation.

As I rotate the bucket, I want to adjust the animated water sprite vertices to get a believable water spill effect.

Since it is hard to explain, please look at this picture I made: http://postimg.org/image/5x0ix0mfp/

(Note that vertices unmodified water sprite is just an animated rectangle.)

I've tried quite a few vertices calculations, and even though I was close a few times, it was still not the effect I wanted. And of course, I'm open to any other suggestions on how to simulate this effect without any costy operations at runtime :) .

Was it helpful?

Solution

Normally water is simulated by creating many particles and having them interact with each other and their environment. Then water is rendered based on particle density in different regions. This is an expensive operation.

Another simulation is less costly but looks less realistic. A 2D grid of values holds particles, these particles only move around the grid and don't have as complicated interaction between each other. Rendering is done the same way. This is less costly but less realistic.

Both of these solutions are pretty complicated to implement and are what I'd consider to be costly operations.

I know you didn't want costly solutions, but maybe the costly approaches will give you some ideas for how to implement a less costly solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top