#Which camera method to use to convert pixels into world space?

6 messages · Page 1 of 1 (latest)

dusk bolt
#

It says here to "Consider using methods on Camera to convert from screen-space to world-space.", this seems kind of vague to me, but I tried a variety of methods with little success. This includes target_scaling_factor, to_logical, and viewport_to_world_2d.

fresh zealot
#

viewport_to_world_2d should be correct afaik

boreal grotto
#

In case if you want to convert drag delta to like 2d world delta (offset from Vec2::ZERO), you might need to

let origin = camera.world_to_viewport(camera_transform, Vec3::ZERO)?;
let world_delta = camera.viewport_to_world_2d(camera_transform, origin + on.delta)?;

I'm not sure a single method on Camera that can do this

fresh zealot
#

do 2d cameras have non-uniform projections?

#

can*?