Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Water and fluids simulation

Author
Message
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 20th Oct 2011 12:14
Hi all,
Anybody knows how to simulate water and fluids in AppGameKit? I've tryed with particles with circle shapes (shape little smaller than the image in order to allow some mix in the image particles) and works but... it's not very reallystic.
Can anybody share any ideas or knows any tutorial about?

Thanks in advance and excuse my english.
Regards.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 20th Oct 2011 13:12
animated sprites & a good artist!
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 20th Oct 2011 13:26
Hmmmm... Not exactly. I refer to the water physics behavior and how the bodies and water drops reacts, not the water graphics itself.
Almus
12
Years of Service
User Offline
Joined: 27th Aug 2011
Location: Brasil
Posted: 20th Oct 2011 14:49
I think you can use a sensor SetSpritePhysicsIsSensor to determine when an object is in the water, so you apply a force against the object pushing it to the surface, when the object is in the surface, gravity will push it back against the water making a buoyancy effect. I think it works.
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 20th Oct 2011 15:20
It's a good idea I'll try it, thanks Almus!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Oct 2011 15:25 Edited at: 20th Oct 2011 15:26
Using circles is the usual way in Box2D. You can get some pretty good results too but you need to work on the surface tension code... that's the hardest part I believe.

The main thing is working out which particles are near the edge and keeping them connected up to a certain amount of force. When they are separated they will still need to attract one another within a certain distance.

Finally you'll have to work out how to make it look like water. Particles at the surface will need to have more intelligent textures than those underneath.

Diggsey produced a great demo for his Box2D plugin for DBPro. I would take a look at that if you're using C++ and want to try a shader...

EDIT: if your water only has a surface at the top then the above suggestion is fine. Nice idea.

Login to post a reply

Server time is: 2024-04-20 04:43:07
Your offset time is: 2024-04-20 04:43:07