Game Development Community

1.5 B3 BUG: density inverted

by And Yet It Moves · in Torque Game Builder · 05/23/2007 (9:15 am) · 9 replies

Hi,
when dealing with rigid physics we noticed that the density seems to have the wrong effect on an objects weight. meaning that for the same density a smaller object is heavier then a bigger object. it still seems that mass or inertia are calculated correctly (we checked via the get-methods) but when applying the same constant force the smaller object fall way faster then bigger ones.

another effect is that a smaller density seems to make the object heavier.

greetings
the ayim team

#1
05/23/2007 (10:12 am)
Could you please post an example of the physics settings to use so I can repro?
#2
05/23/2007 (11:17 am)
Produce 2 t2dSceneObjects with different sizes, call em "obj1" and obj2". then write these functions (and execute them):

function t2dSceneObject::startphysics(%this)
{
%this.setDensity(0.01);
%this.setFriction(0.1);
%this.setRestitution(0.0);

%this.setConstantForce("0 260");
}

function startAllPhysics()
{
obj1.startphysics();
obj2.startphysics();
}

if you call startAllPhysics() from the console they will fall with different speeds.

the other strange thing is when you set denstity to an higher value e.g.:

%object.setDensity(0.05);

the object will fall slower than before (shouldn't it be the other way round?)
#3
05/23/2007 (8:02 pm)
Yes I repro'd this in the meantime and I guess it indeed it is inverted which puts me in mind of 1/mass etc somewhere along the line.

I will look into it.
#4
05/23/2007 (10:16 pm)
It seems to me that the higher the density the slower it should move. Higher density means higher mass, which in turn means higher inertia which means that it will take more work to get it to move.
#5
05/24/2007 (3:08 am)
Yes, you're right, it shoult take more effort to move the object once on the ground, but if they are free falling, heavier objects should fall faster or same speed, if gravitic is set true.

rigth now objects appear to be floating if you raise the density.
#6
05/24/2007 (6:31 am)
Ah, I see, that makes sense. They should fall at the same speed (remember the tennis ball bowling ball trick?:)
#7
05/24/2007 (7:02 am)
Well objects fall at the same speed in a vacuum, however in air objects will fall at rates dependent on their density (e.g. sponge/cannon ball) shape and aerodynamic properties etc. Something that has the same mass but lower density will by definition take up more space and so have more surface area for air flow etc to play with.
#8
05/24/2007 (5:06 pm)
Interesting, good to know.
#9
05/24/2007 (7:19 pm)
@AYIM:

As for you seeing differing velocities for objects with the same density but different sizes internally TGB auto calculates a mass from Density = Mass / Area which would give you Mass = Density * Area and so a larger mass for the same density but larger size as one would obviously need more mass to spread over the larger area to keep the same density.

And from Newtons 2nd Law of Motion ( F = MA ) that we all know you would have A = F/M which means the acceleration would get smaller as mass gets larger and the force stays constant (as common sense tells us no doubt)