Browse Source

Update camera.md (#559)

* Update camera.md

* Update camera.md for `ru`
Artsiom Trubchyk 1 tháng trước cách đây
mục cha
commit
75aaa3b414
2 tập tin đã thay đổi với 7 bổ sung19 xóa
  1. 1 7
      docs/en/manuals/camera.md
  2. 6 12
      docs/ru/manuals/camera.md

+ 1 - 7
docs/en/manuals/camera.md

@@ -229,12 +229,6 @@ function M.screen_to_world(camera, screen_x, screen_y, z)
     local projection = go.get(camera, "projection")
     local view = go.get(camera, "view")
     local w, h = window.get_size()
-    -- The window.get_size() function will return the scaled window size,
-    -- ie taking into account display scaling (Retina screens on macOS for
-    -- instance). We need to adjust for display scaling in our calculation.
-    local scale = window.get_display_scale()
-    w = w / scale
-    h = h / scale
 
     -- https://defold.com/manuals/camera/#converting-mouse-to-world-coordinates
     local inv = vmath.inv(projection * view)
@@ -246,7 +240,7 @@ function M.screen_to_world(camera, screen_x, screen_y, z)
 end
 ```
 
-Visit the [Examples page](https://defold.com/examples/render/screen_to_world/) to see screen to world coordinate conversion in action. There is also a [sample project](https://github.com/defold/sample-screen-to-world-coordinates/) showing how to do screen to world coordinate conversion.
+Keep in mind that the values `action.screen_x` and `action.screen_y` from `on_input()` should be used as arguments for this function. Visit the [Examples page](https://defold.com/examples/render/screen_to_world/) to see screen to world coordinate conversion in action. There is also a [sample project](https://github.com/defold/sample-screen-to-world-coordinates/) showing how to do screen to world coordinate conversion.
 
 ::: sidenote
 The [third-party camera solutions mentioned in this manual](/manuals/camera/#third-party-camera-solutions) provides functions for converting to and from screen coordinates.

+ 6 - 12
docs/ru/manuals/camera.md

@@ -226,17 +226,11 @@ end
 -- @return world_y мировая координата Y
 -- @return world_z мировая координата Z
 function M.screen_to_world(camera, screen_x, screen_y, z)
-	local projection = go.get(camera, "projection")
-	local view = go.get(camera, "view")
-	local w, h = window.get_size()
-	-- window.get_size() возвращает масштабированный размер окна,
-	-- учитывая дисплейный масштаб (например, Retina на macOS).
-	-- Нужно скорректировать размер с учётом масштаба.
-	local scale = window.get_display_scale()
-	w = w / scale
-	h = h / scale
-
-	-- https://defold.com/manuals/camera/#converting-mouse-to-world-coordinates
+    local projection = go.get(camera, "projection")
+    local view = go.get(camera, "view")
+    local w, h = window.get_size()
+
+    -- https://defold.com/manuals/camera/#converting-mouse-to-world-coordinates
     local inv = vmath.inv(projection * view)
     local x = (2 * screen_x / w) - 1
     local y = (2 * screen_y / h) - 1
@@ -246,7 +240,7 @@ function M.screen_to_world(camera, screen_x, screen_y, z)
 end
 ```
 
-На странице [Примеры](https://defold.com/examples/render/screen_to_world/) показано использование преобразования экранных координат в мировые. Также есть [примерный проект](https://github.com/defold/sample-screen-to-world-coordinates/) с демонстрацией этого процесса.
+Имейте в виду, что значения `action.screen_x` и `action.screen_y` из `on_input()` должны использоваться как аргументы для этой функции. На странице [Примеры](https://defold.com/examples/render/screen_to_world/) показано использование преобразования экранных координат в мировые. Также есть [примерный проект](https://github.com/defold/sample-screen-to-world-coordinates/) с демонстрацией этого процесса.
 
 ::: sidenote
 [Сторонние решения для камеры](/manuals/camera/#third-party-camera-solutions) предоставляют функции для преобразования координат между экраном и миром.