Jumping away from a wall

I am trying to make a 2D platformer and I want the player to jump away from the wall when he does a wall jump. I recall during an FPS tutorial I did that there was some API function that allowed you to find the angle perpendicular to the surface you had collided with.

For instance, if you were to shoot the ground from any angle, it knew to animate the spark straight up away from the ground. Also, if you shot the wall, it knew to animate sideways away from the wall.

That FPS tutorial is not longer there so I’m not sure if that was one of the outdated functions. Any help will be greatly appreciated. I am using the character controller.

if (controller.collisionFlags == CollisionFlags.Sides) //if touching walls only

{

moveDirection.x = //away from the wall;

moveDirection.y = wallJumpSpeed;

}

You can use character controller’s OnControlColliderHit event and analyze the ControllerCollidrHit argument which has a “normal” property which returns collision normal vector and “moveDirection” which returns the moving direction in the moment of collision.
Then you can use
movement = Vector3.Reflect(moveDirection, normal);
and also add some vertical speed to keep afloat for chain wall jymps
movement.y += jumpOffHeight;