Slopes and gravity
by Sean Dugan · in Torque Game Builder · 06/21/2007 (6:58 pm) · 1 replies
Is there any simple way to keep a character from sliding down a hill due to the force from the gravity? I have tried turning the gravity off whenever the player came in contact with the ground, but I am having trouble trying to get it to re-activate when the character is no longer touching the ground. I can re-activate it when the player jumps, but that's not the only time the gravity is necessary, as the character can simply walk off a cliff, for instance, and not fall.
I know triggers have a onLeave function (or something like that) that runs when the objects no longer collide, but I was hoping to not have to use them. Is this the only way to really detect when they are not colliding?
Thanks.
I know triggers have a onLeave function (or something like that) that runs when the objects no longer collide, but I was hoping to not have to use them. Is this the only way to really detect when they are not colliding?
Thanks.
About the author
Torque Owner Melissa Niiya
onLeave looks like a fairly viable option and I know people have used in the past for platformer-type games. Another way to do it might involve using castCollision(). Why were you hoping not to use onLeave? Does it conflict with something else in your project?
You may want to check this out.
http://tdn.garagegames.com/wiki/TGB/MiniPlatformerTutorial