Hi,
I'm writing a 2d platformer using libGdx and box2d. One of the features is slopes.
I'm handling slopes quite will albeit not perfect. in my listener's begincontact, I know touched a slope so I set the body's gravityscale to 0. On endcontact back to 1.
However, this is not the perfect solution. Because when the player stops on the slope and then starts moving again, contact with the slope ends so gravity is back in place.
I'm also moving the player using linearvelocity and not applying an impulse.
The effect of the above, is that, going downhill, the player jumps off the slopes.
Is there a better to handle this?
I'm writing a 2d platformer using libGdx and box2d. One of the features is slopes.
I'm handling slopes quite will albeit not perfect. in my listener's begincontact, I know touched a slope so I set the body's gravityscale to 0. On endcontact back to 1.
However, this is not the perfect solution. Because when the player stops on the slope and then starts moving again, contact with the slope ends so gravity is back in place.
I'm also moving the player using linearvelocity and not applying an impulse.
The effect of the above, is that, going downhill, the player jumps off the slopes.
Is there a better to handle this?