OrthographicProjection
OrthographicProjection
- near : f32
- far : f32
- viewport_origin : glam::Vec2
- scaling_mode : bevy_render::camera::projection::ScalingMode
- scale : f32
- area : bevy_math::rects::rect::Rect
Description
Project a 3D space onto a 2D surface using parallel lines, i.e., unlike [
PerspectiveProjection
], the size of objects remains the same regardless of their distance to the camera.The volume contained in the projection is called the view frustum. Since the viewport is rectangular and projection lines are parallel, the view frustum takes the shape of a cuboid.
Note that the scale of the projection and the apparent size of objects are inversely proportional. As the size of the projection increases, the size of objects decreases.
Examples
Configure the orthographic projection to one world unit per 100 window pixels:
# use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; let projection = Projection::Orthographic(OrthographicProjection { scaling_mode: ScalingMode::WindowSize, scale: 0.01, ..OrthographicProjection::default_2d() });