Making Item fall
by Telmo Menezes · in Torque Game Engine · 04/07/2005 (4:02 pm) · 4 replies
Hi,
I tried creating an Item high above the ground and I expected it to fall, but it doesn't. I initizlized the item with this datablock:
datablock ItemData(Xpto)
{
shapeFile = "~/data/shapes/items/Xpto.dts";
mass = 1;
density = 1;
friction = 1;
elasticity = 0.3;
gravityMod = 1;
};
What must I do to get gravity to work?
TIA!
I tried creating an Item high above the ground and I expected it to fall, but it doesn't. I initizlized the item with this datablock:
datablock ItemData(Xpto)
{
shapeFile = "~/data/shapes/items/Xpto.dts";
mass = 1;
density = 1;
friction = 1;
elasticity = 0.3;
gravityMod = 1;
};
What must I do to get gravity to work?
TIA!
About the author
#2
04/09/2005 (3:30 am)
Items should still fall (thats why there are variables like gravitymod etc). I have been playing around with the Item classes for a couple of weeks. I have based an object off them. Have you made any changes to the class in the engine?
#3
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5495
I'm coming to the conclusion that the physics part of Torque could be improved. Why shouldn't Items fall? Shouldn't physics be implemented at a lower level in the object hierarchy?
My option is going to be to ditch Items altogether and just modify the class in the post I showed to have Item behaviour (which should be much easier to implement than physics).
Regards,
Telmo Menezes.
04/09/2005 (8:27 am)
Thanks for your answers. Meanwhile I found this post that should help me solve my problem:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5495
I'm coming to the conclusion that the physics part of Torque could be improved. Why shouldn't Items fall? Shouldn't physics be implemented at a lower level in the object hierarchy?
My option is going to be to ditch Items altogether and just modify the class in the post I showed to have Item behaviour (which should be much easier to implement than physics).
Regards,
Telmo Menezes.
#4
These lines are where gravity affects the velocity in the Item class... (please let me know if i'm wrong here BTW)
mVelocity.z += (mGravity * mDataBlock->gravityMod) * dt;
// Container buoyancy & drag
mVelocity.z -= mBuoyancy * (mGravity * mDataBlock->gravityMod * mGravityMod) * dt;
mVelocity -= mVelocity * mDrag * dt;
04/09/2005 (5:46 pm)
Bah, they do fall!!! I am using the Item class and my objects fall. I'm am not why yours aren't falling, are you sure you haven't changed something in the engine classes?These lines are where gravity affects the velocity in the Item class... (please let me know if i'm wrong here BTW)
mVelocity.z += (mGravity * mDataBlock->gravityMod) * dt;
// Container buoyancy & drag
mVelocity.z -= mBuoyancy * (mGravity * mDataBlock->gravityMod * mGravityMod) * dt;
mVelocity -= mVelocity * mDrag * dt;
Torque Owner Bruno Grieco