- Home /
How to Make a rigidbody fall straight away?
I have a character in a game and when he goes over the edge the character is meant to fall to the bottom of a pit. It all works but there seems to be a slight delay before the character actually starts moving down using gravity. I can literally walk over the edge and back on to the ledge before he actually starts falling (moving down).
i have tried putting the rigidbody(of the character) mass up high (3000) and putting the drag down to 0.001 but it really doesn't have much effect.
I want the character to start falling straight away when he goes over the edge and not allow the player to bring the character back to the ledge again.
Thanks
Answer by Ghopper21 · Feb 09, 2013 at 01:39 PM
You can make gravity stronger in the physics settings, i.e. go to Edit > Project Settings > Physics and make the Y value for gravity a bigger negative number.
This may be enough for you but in theory the player could still come back if they turn around fast enough, and it will mess with your physics elsewhere in the game, which may not be what you want.
A more robust alternative would be to have a trigger collider around the edge. When the character collides with it, you disable movement, so they are literally hanging there, unable to move, while gravity takes over and they start to fall down.
Perhaps even better, you could instead change your character input-handing code to only allow movement when the character is touching the ground, i.e. put a trigger collider on the ground. Once off the edge, the character would no longer be on the ground, and wouldn't be able to move back. This has the advantage of being more consistent throughout the game, e.g. your character would not be able to move while jumping or falling within the game world, which would probably make sense.
Note if you have some kind of move animation (moving legs or whatever), it might be amusing to have this still run even when not touching the ground, despite not actually moving (so the legs would move while hanging in mid-air).
Some good advice in your answer. I'll try some of your ideas.
Thanks Again!