Game Development Community

Puishing objects in a platform engine

by AzraelK · in Torque Game Builder · 02/20/2007 (7:45 am) · 1 replies

Has anyone succesfully made a pushable object in a platform engine? Ive tried several times, but I can get the right combination of collision and physics settings to do so.

Oh btw Im not using a "RIGID" object, im simply using an object which position can be modified by physics.

#1
02/20/2007 (9:01 am)
@AzraelK, it would probably be best, if you wanted to 'push' the object, that onCollision you mount the object being pushed to the player ... and when the player changes direction... unmount the object before moving the player, to simulate a 'push'

ie;

Player walks to the right of the screen, walks into a crate they can push

The player collision with the crate triggers a 'mount crate to player' code snippet

Player continues to walk to the right, crate moves with player as it's mounted

Player jumps or changes direction (left, up, down, etc) and crate is then unmounted

In the event you want to push the crate to reveal a hole in the floor that the player can fall in, place a trigger just past where the crate was so that when the player enters the trigger, the crate is then no longer mounted and the players default gravity kicks in and the player begins to fall through the hole --


This is one possible solution, with some tweaks, that should work, and does not rely on physics -- as the physics in TGB are 'iffy' at best for things like this, it seems best to work around them by not using them at all unless you absolutely need them -- pushing a crate seems a functionality that you would not need physics --