Get the angle of the face normal from a raycast hit

I’m trying to check the angle of the slope my character is standing on.
The pickingInfo has a getNormal function that returns a Vector3, I think relative to the picking ray’s direction?
Given that the ray I’m checking will always hit the mesh (in this case the ground) from straight above, how can I can get the angle of the face normal that the ray has hit?

    /*
     * returns the slope (in radians) of a vector in the vertical plane
     */
    private _verticalSlope(v: Vector3): number {
        return Math.atan(Math.abs(v.y / Math.sqrt(v.x * v.x + v.z * v.z)));
    }

Implementation - BabylonJS-CharacterController/CharacterController.ts at 683869e6f73f6154852b7702a95a28a5a2bdd4ad · ssatguru/BabylonJS-CharacterController · GitHub

1 Like

Thanks, that seems to do it :slight_smile: