Game Development Community

Rigid Body interaction question

by Nicolai Dutka · in Torque Game Engine Advanced · 07/21/2008 (11:22 am) · 2 replies

I am playing around with the default rigid body boulder that came with TGEA and was wondering how I can make it more interactable. In the editor, if I pick up the boulder and drop it, it will roll around, bounce, etc, but if I slam into it with my character in game, nothing happens. Why not?

Ultimately, I'd like the player to be able to walk up to ANY given rigid body and have him be able to push it (given that it isn't too heavy, which would be determined by that rigid body's datablock, yes?)...

Is this not built into the physics engine?

#1
07/21/2008 (11:49 am)
No, its not built in, you have to apply an impulse to the object you want to move (usually using the players forward vector on collision or checking forward with a raycast). the collisions/physics in tgea just stop each other like static objects , i think everyone is waiting on GG to roll out a physics update ;)

Hope that helps abit.
#2
07/21/2008 (11:57 am)
Ya, I found some code on TDN that helped: http://tdn.garagegames.com/wiki/TorqueGameEngine/RigidShape

That gave me some onCollision code to work with. Applying that works really well, but there is the occasional physics glitch:

If I push my character against a rigid body cube in dead center, he can't move it (unless he hits it at a full run). This is good. If I continue pushing up against it and begin sliding toward one edge, once I reach that edge, the box goes FLYING through the air.

Other than that, it's all good.