Game Development Community

Gravity

by Levi Putna · in Torque Game Engine · 12/17/2006 (1:32 am) · 5 replies

Just a quick question.
Is there a easy way to apply gravity to an object the game would? I know you can do it with an item datablock but can you use this functionality anywhere else?

Thanks

#1
12/17/2006 (5:04 am)
Hi,

Datablocks define each of your objects within the game world, which are repeated to all of the network clients so that everyone is playing with the same rules. Datablocks are a good thing.

If I can ask, why do you want to find another way? What effect are you trying to achieve? What kind of improvements are you hoping for?

It will help tons if you give us some background and some context for your question.
#2
12/17/2006 (5:34 am)
I have created some boxes, crates, barrels excreta these objects can be shot at and destroyed, sometimes the objects are stacked on top of each other, when I destroy the bottom object I want the top one to fall down to the ground instead of just floating around in the air.
#3
12/17/2006 (7:19 am)
Ah. I see.

Assuming that your objects are of the rigidshape class, you may have some options. As I understand it, for network performance reasons, gravity doesn't affect rigidshape objects that are at rest. However if the shape is moving at the time its supporting object is destroyed, then it will fall normally. My understanding of the way this works may be off, and I'm sure someone will correct me if I'm wrong.

Integrating ODE or PhysX into TGE would offer the best results, but if you're wanting to stick with standard Torque rigidshape gravity effects without messing with the engine code, you could try the following . . .

By setting your projectiles to exert a very small amount of impulse force over a large area whenever they impact with a target, that should get all of your crates moving just a little bit. Hopefully enough for your objects to start observing gravity again.

As a disclaimer, I've never tried this and don't know if it 'will' work, but from a theoretical point of view, it 'should' work.
#4
12/21/2006 (5:01 am)
Quote:
By setting your projectiles to exert a very small amount of impulse force over a large area whenever they impact with a target, that should get all of your crates moving just a little bit. Hopefully enough for your objects to start observing gravity again.

I thought the crossbow projectile had impulse damage set by default.

Quote:
radiusDamage(%obj, %pos, %this.damageRadius, %this.radiusDamage, "Radius", %this.areaImpulse);

Shouldn't the "areaImpulse" cause the nearby stacked items to move somewhat and therefore "start observing gravity again?

Thanks!

Tony
#5
12/21/2006 (5:41 am)
For the crossbow, yeah. But Levi may have replaced his crossbow already (I know I did a long time ago).