|
Post by Pyre on Dec 6, 2005 8:42:54 GMT 1
Hi !!
I'm quite new to your wrapper !! I find it really nice, it enables me to make great things quickly... But I've got a problem, and I think it's not a bug it's just that I'm not using it the right way.
I use
cube=NDB_NewtonCreateBox(10,40,10) Id = NDB_NewtonCreateBody( cube ) NDB_BodySetDBProData Id,obj `obj is an object number
NDB_BuildMatrix 0.0, 0.0, 0.0, 0.0,40.0,0.0 NDB_NewtonBodySetMatrix VGperso.id
|
|
|
Post by Pyre on Dec 6, 2005 8:43:28 GMT 1
Err sorry I send it without finishing... let me continue
|
|
|
Post by Pyre on Dec 6, 2005 8:50:30 GMT 1
So, here is the whole piece :
**************** cube=NDB_NewtonCreateBox(10,40,10) Id = NDB_NewtonCreateBody( cube ) `obj is an object number NDB_BodySetDBProData Id,obj
NDB_BuildMatrix 0.0, 0.0, 0.0, 0.0,40.0,0.0 NDB_NewtonBodySetMatrix Id
`I calculate it for a sphere even if my body is a box, is that wrong ? NDB_CalculateMISphereSolid Mass,20.0 NDB_NewtonBodySetMassMatrix Id,Mass
NDB_NewtonBodySetAutoFreeze Id, 0 NDB_BodySetGravity Id, 1
NDB_SetVector 0.0, 1.0, 0.0 a = NDB_NewtonConstraintCreateUpVector( Id)
PlayerID = NDB_NewtonMaterialCreateGroupID() NDB_NewtonMaterialSetDefaultFriction Default, PlayerID, 0.01, 0.01 NDB_NewtonMaterialSetDefaultElasticity Default, PlayerID, 0.01
NDB_NewtonBodySetMaterialGroupID VId, PlayerID
NDB_NewtonReleaseCollision cube ****************
When I use NDB_NewtonBodyGetMassMatrix, it returns the good mass.
But when I change the mass, it doesn't change the acceleration due to gravity. I use NDB_BodyAddForceGlobal to make my object jump, but it always fall with the same speed, whatever the mass... But when I change gravity, of course it changes the speed...
Well... mass seems to be useless !! ?? Do I use it the wrong way ?
Thx for answering !!
Pyre
|
|
|
Post by walaber on Dec 6, 2005 18:36:45 GMT 1
this is accurate physiscs. all objects fall at the same acceleration due to gravity. the only difference is that on earth there is wind-resistance, so larger objects my fall slightly slower than others. but try it for yourself. drop a tennis ball and a bowling ball from the same height- they will hit the ground at the same time.
|
|
|
Post by Pyre on Dec 8, 2005 10:16:55 GMT 1
Lol... I'm stupid !!!
Of course you're right, and I know it since a long long time... but I simply forgot that sum of all forces = mass * acceleration, and force due to mass = mass*gravity, then acceleration = gravity... I've written it so many time in my exams... lol...
Thx !!
And, well, could you explain me then why we have to set the mass ? what do you you the mass for ?
Well, to simulate wind-resistance, I think I just have to decrease speed, based on the height of the object... Or should I add a force related to the square of the speed and oppose to the speed vectors ? This must be more realistic, but wouldn't it take too long to calcul ?
Thx !!
Bye
Pyre
|
|