Unity3d - 什么是线播 hit.normal

Unity3d - what is linecast hit.normal

我正在尝试从直播中了解 hit.normal return 的作用。 这是检查字符斜率限制的简单方法,我唯一想知道的是 hit.normal 它是什么?


private void check_slope_limit() {
    // Var
    var hit_angle = 0f;

    // Raycast
    RaycastHit hit;

    // Line of direction: if hit ground layer
    if (
        Physics.Linecast(transform.position + Vector3.up, transform.position + direction.normalized, out hit, ground_layer)
    ){
        hit_angle = Vector3.Angle(Vector3.up, hit.normal);

        var target_point = hit.point + direction.normalized;

        Debug.DrawLine(transform.position + Vector3.up, transform.position + direction.normalized, Color.yellow);

        if (
            hit_angle > slope_limit 
            &&
            Physics.Linecast(transform.position + Vector3.up, target_point, out hit, ground_layer)
        ){
            if (hit_angle > slope_limit){
                move = false;
                return;
            }
        }
    }
    move = true;
}


我真的很讨厌在不理解的情况下做事

这是命中点的表面normal: