I am working on a platformer that involves sloped terrain. Instead of rolling my own, I'm using the slope detection behavior from the Run-n-Jump kit. I have a couple of questions I'm hoping someone can help me with.
1) What is the "slope grade" reported by the slope detection code? A 45 degree incline should be a 100% grade, but when my actor hits a 45 degree slope, the "slope grade" is reported as 29.xxxx.
2) I want my actor to elegantly rotate to match the slope he is on. I'm wondering which of several options my fellow Stenylers think is best.
2a) One option is to use multiple collision boxes at the bottom of my actor (which is a vehicle, not a humanoid character), and when the first box hits, rotate a certain percentage of the slope, when the second box hits, rotate a little more, and so on.
2b) The other option I am considering is turning on rotation in physics (currently, the actor cannot rotate in the physics engine), but limiting it to +/- X degrees of rotation. Then, of course, I need to make sure he only rotates when entering or leaving a slope, and not when bumping into things in mid-air, or when ramming a wall. Another problem with this approach is that my actor seems to want to rotate FORWARD when the bottom of his collision box hits a slope, like he's tipping forward from momentum. I don't know how well I can counter this by changing the shape of his collision box.
I'm open to suggestions. I usually do my own crude physics with platformers, but I would really like to use the built-in Box2D functionality, this time around.