Open
Description
How can Bevy's documentation be improved?
Inside of bevy_render/src/camera/camera.rs
, the following documentation for ndc_to_world
states:
/// Given a position in Normalized Device Coordinates,
/// use the camera's viewport to compute the world space position.
///
/// When the position is within the viewport the values returned will be between -1.0 and 1.0 on the X and Y axes,
/// and between 0.0 and 1.0 on the Z axis.
/// To get the world space coordinates with the viewport position, you should use
/// [`world_to_viewport`](Self::world_to_viewport).
///
/// Returns `None` if the `camera_transform`, the `world_position`, or the projection matrix defined by [`CameraProjection`] contain `NAN`.
///
/// # Panics
///
/// Will panic if the projection matrix is invalid (has a determinant of 0) and `glam_assert` is enabled.
I believe this should state:
/// When the position is within the viewport the values returned will be between `-world_max_width/2.0` and `world_max_width/2.0` on the X axis, `-world_max_height/2.0` and `world_max_height/2.0` on the Y axis, and between `0.0` and `world_max_depth` on the Z axis.
/// where `world_max_width` is the maximum world width, `world_max_height` is the maximum world width, and `world_max_depth`
/// is the maximum depth, in units (by default, pixels) defined by the user.
For reference, when running the above code in my world, I can definitely get it to be outside the -1.0
to 1.0
bounds. It seems like this is an input constraint, not an output constraint, though I wanted to be sure before I posted a PR.