Buoyancy + Waves

Got Buoyancy (developed by BorisTheBrave) working with a variable height water surface in WCK. It's not physics-perfect but should work very well for games. There's a demo here:

http://www.sideroller.com/wck/?f=6

And a screenshot:

Attachment:
bwaves.jpg


The big "hump" is a moving wave generated by code. The other smaller "humps" are waves from objects impacting the water.
I'm very excited about this feature.

I just put it into a game that my team are sending to a competition soon.
noticed a few minor bugs.

haven't run any simplified tests yet but here is what i think I'm seeing.

beginContact doesn't seem to happen for wave humps. but does happen for the area the rectangle box occupies.

Circles break it, not always instantly but seems to happen every time after a few seconds.

here is the error traces

Quote:
Warning: Filter will not render. The DisplayObject's filtered dimensions (-222384660, -222384660) are too large to be drawn.
Assertion failed: (kNormal > 1.19209290E-07F), function InitializeVelocityConstraints, file ../Box2D/Dynamics/Contacts/b2ContactSolver.cpp, line 159.

[object AlchemyExit]
at <anonymous>()
at <anonymous>()
at Box2DAS.Dynamics::b2World/HandleStep()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at Box2DAS.Common::b2EventDispatcher/dispatchEvent()
at Box2DAS.Dynamics::b2World/Step()
at wck::World/step()
Assertion failed: (kNormal > 1.19209290E-07F), function InitializeVelocityConstraints, file ../Box2D/Dynamics/Contacts/b2ContactSolver.cpp, line 159.


the [object AlchemyExit] .... bit repeats after that.
and the waves spike a lot like a tremendous force keeps crashing into the water.


pretty sure i can just use oval for now (since its built with line segments it's not likely to experience the error)
so not a show stopper.

thank you so much for this wave stuff !
sketchbookgames wrote:
beginContact doesn't seem to happen for wave humps. but does happen for the area the rectangle box occupies.


Use the "liquidSurfaceOffset" property to inset the height of your water. Basically "liquidSurfaceOffset" should be how high you expect your waves to get. If you look at the demo, the buoyancy instance actually fills the entire screen, but "liquidSurfaceOffset" pushes the surface down to leave room for waves.

sketchbookgames wrote:
Circles break it, not always instantly but seems to happen every time after a few seconds.


I noticed this too. There's a few bugs with the latest Box2D that cause it to crash, and I think this is related.

sketchbookgames wrote:
and the waves spike a lot like a tremendous force keeps crashing into the water.


The enter-water exit-water splashes aren't perfect. basically it creates a new splash for every body then waits a bit before that body is able to create a splash again. This could probably be better. If you post a demo where this works awful that would help.
the wave spikes problem is a symptom of the circle crash, not a separate bug.
used this feature in a Sand Castle Game
http://www.box2d.org/forum/viewtopic.php?f=6&t=5353
works great! thanks for having the perfect timing on adding that feature 🙂

Original thread: https://box2d.org/forum/viewtopic.php?t=5316