title: How do I calculate the downward slope vector of a 3D polygon?
body: <p>I'm writing a collision detection system for a 3D platformer video game. All the basics are working well. But when the character lands on a steep-slope polygon, I need them to slide down the slope of the polygon. I can do most of this, but I can't find out how to calculate the downward vector that matches the slope of the given polygon they have collided with. I have searched many forums, including this one, but can't find the answer.</p>
  
  <p>Each polygon is composed of 3 vertices (x, y, z) in world space.</p>
  
  <p>I also have the surface normal for each polygon, and am familiar with dot and cross products.</p>
  
  <p>I can also calculate a simple angle value for the polygon by taking the arccos of the dot product of the face normal and the world up vector, which gives the angle of the slope of the polygon from level ground, like 60 degrees. If the angle is steeper than 60 degrees, I decide that the character should slide down the slope. But I need the downward vector that matches the slope of the polygon, so I can apply their position to it over time and thus, slide down.</p>
  
  <p>I believe the slope vector should be perpendicular to the surface normal, but I don't see how to calculate it given the information I have.</p>
  
  <p>Thanks for any help...</p>