Buoyancy Demo

Horizon

01-02-2006 13:53:35

I was intrigued by something in the buoyancy demo. All boxes in the demo are created with makeSimpleBox, right? makeSimpleBoxes sets the mass of the bodies as follows Ogre::Real mass = size.x * size.y * size.z * 2.5;

This means the density of all the boxes is the same, right?

Why is it then, that, when viewing the demo, there are always 1 or 2 boxes that don't float, but rather slowly sink to the bottom?

walaber

01-02-2006 20:12:16

hmmm... that seems right... so I'm not entirely sure why that would happen...

OvermindDL1

02-02-2006 01:26:26

Hadn't looked at the code, but same thing happened in the demo I compiled. Like two of them sunk slowly and stayed at the bottom, like they were just *barely* too heavy to float, the others floated fine.

walaber

02-02-2006 04:01:38

yeah, it happens alright. I'm just not sure why.

Horizon

02-02-2006 12:15:53

It's a problem I first encountered over a month ago. I posted about it on the Newton forum, but I think I wasn't really explaining it well enough, as people said it was a matter of tweaking parameters. Now that you are able to reproduce the problem, it could in fact be a problem with either OgreNewt or Newton itself.

Horizon

08-02-2006 01:51:06

Walaber, have you yet any better idea what's causing this? I was hoping that if it's not an OgreNewt problem you'd use your contact with Julio Jerez to find out what's causing it? As I explained, my previous post about this issue kind of got dismissed.

Horizon

16-02-2006 15:03:57

Thanks for finding out about the previous problem and fixing it! I have another question though, albeit one I'm a little less sure about.

In the Buoyancy Demo try pulling underwater first one of the smaller objects and then one of the larger objects. You'll see that the larger object rises faster (alot faster actually).

If you think this might be correct, because the object is larger, has a larger displacement thus a larger buoyant force and therefor rises faster, I will explain below.

Suppose we have two objects, one of size 1x1x1 and one of size 10x10x10. They have density 0.5. The water has density 1.0.
Object A:
gravity is 1x1x1 * .5 * 10 (9.8 rounded up) = 5N
buoyancy is 1x1x1 * 1 * 10 (idem) = 10N
netto force is 10-5 = 5N

Object B
gravity is 10x10x10 * .5 * 10 (9.8 rounded up) = 5000N
buoyancy is 10x10x10 * 1 * 10 (idem) = 10000N
netto force is 10000-5000 = 5000N

So far so good. The netto force is indeed larger for the larger object. However, to determine it's acceleration we divide by it's mass:
Object A acceleration is 5N / (1x1x1 * .5) = 10m/s^2
Object B acceleration is 5000N / (10x10x10 * .5) = 10m/s^2

So, the acceleration for both objects should be the same. Actually if either of them should be slower it should be the larger one because it has more drag!

Edit: I found out about this because I noticed smaller objects generally move slower in water, strange as it may seem. E.g. I added the 'shooting' of cylinders/cubes/whatnot from BasicsDemo to BuoyancyDemo and noticed that the newly created objects (size 1) acted strangely in the water. I don't know if it is at all related to the above problem though. I would have posted about this on NGD were it not that there's no buoyancy demo in NGD to test/show it with.

walaber

16-02-2006 17:25:28

hmm... i've no idea... this is definately a question for Julio and the other Newton masters... if you want, post a new thread, and include a binary of the bouyancy demo rigged to show what you want. as lons as you are linking against the DLL version of Newton, Julio can debug it.

Horizon

16-02-2006 17:48:14

Ok thanks. It actually shows up in the buoyancyDemo as is. I'll try to post it on NGD tomorrow.

Horizon

16-02-2006 22:48:11

Ok, I've added this to my earlier thread about Buoyancy. Hopefully there'll be some answer by the time I get back from my week in the mountains :).

Horizon

27-02-2006 00:16:17

I don't seem to have gotten any useful reactions, but I can't find any mistakes in your demo code either, walaber. Any ideas?

Tora-Bora

02-03-2006 16:34:40

I think in me->addBouyancyForce( 0.4, 0.5, 0.5, gravity, OgreNewtonFrameListener::buoyancyCallback ); gravity must be only Ogre::Vector3(0,-9.8,0) - without mass. And first param 1.0 i.e kg/m3 normal water density.
Another problem: changing second and third params has no affect.

Horizon

02-03-2006 17:55:05

What source code version are you looking at? The gravity thing has been fixed in the latest cvs version.

The waterdensity should probably be about 1.0 yeah, but this doesn't change the fact that the boxes act weird.