# Sliding down the slope

I've just gotten a triangle collision object in using the Separate Axis Theorem, the triangle has a 45 degree slope and resloves collision detection via the projection method. The actual collision detection works fine, but I'm having an issue where the character keeps slipping down the slope when he runs up or goes down it.

These are the number for the characters movement. I know I should be doing something with either the part of the Y velocity or somehow changing the x velocity but not sure what.

The number for the velocity

private float accerlation = 0.25f;
velocity.X = velocity.X - accerlation

private float superaccerlation = 0.3f;
velocity.X = velocity.X - superaccerlation


How the collision is being resolved.

if (collision == TileCollision.LeftSlope)
{
Vector2 triDepth = RectangleExtensions.GetIntersectionDepthTriLeft(bounds, tileBounds);

if (triDepth.X != 0 && triDepth.Y != 0)
{
isOnSlope = true;
Position = new Vector2(Position.X + triDepth.X, Position.Y + triDepth.Y);
}
else if (triDepth.X != 0 && triDepth.Y == 0)
Position = new Vector2(Position.X + triDepth.X, Position.Y);
else if (triDepth.X == 0 && triDepth.Y != 0)
{
Position = new Vector2(Position.X, Position.Y + triDepth.Y);
}

bounds = BoundingRectangle;

} 