Преглед изворни кода

Chinese Edition (#117)

* 2 more files finished.

* some fixes & catch up to master on 9-17-20

* gui

* shader

* catch up with master 290b0e0

* 35%

* input

* 50%

* 75%

* physics

* the last one: live-update 90%
todo: fix in-manual links

* url fixed

* 95%

* 100% All finished.
CocosGames пре 5 година
родитељ
комит
4a8f056b84
43 измењених фајлова са 834 додато и 820 уклоњено
  1. 1 1
      docs/zh/manuals/adapting-graphics-to-screen-size.md
  2. 1 1
      docs/zh/manuals/ads.md
  3. 2 2
      docs/zh/manuals/android.md
  4. 2 0
      docs/zh/manuals/building-blocks.md
  5. 4 4
      docs/zh/manuals/bundling.md
  6. 1 1
      docs/zh/manuals/camera.md
  7. 1 1
      docs/zh/manuals/collection-factory.md
  8. 42 42
      docs/zh/manuals/collection-proxy.md
  9. 2 2
      docs/zh/manuals/components.md
  10. 1 1
      docs/zh/manuals/debugging-native-code.md
  11. 1 1
      docs/zh/manuals/dev-app.md
  12. 15 1
      docs/zh/manuals/editor.md
  13. 1 1
      docs/zh/manuals/extension-facebook.md
  14. 3 3
      docs/zh/manuals/extension-fbinstant.md
  15. 1 1
      docs/zh/manuals/extensions-best-practices.md
  16. 2 2
      docs/zh/manuals/extensions-debugging.md
  17. 2 2
      docs/zh/manuals/file-access.md
  18. 2 2
      docs/zh/manuals/flash.md
  19. 1 4
      docs/zh/manuals/getting-help.md
  20. 1 1
      docs/zh/manuals/glossary.md
  21. 1 1
      docs/zh/manuals/gui-layouts.md
  22. 136 136
      docs/zh/manuals/gui.md
  23. 3 3
      docs/zh/manuals/html5.md
  24. 1 1
      docs/zh/manuals/importing-graphics.md
  25. 102 102
      docs/zh/manuals/input.md
  26. 1 1
      docs/zh/manuals/introduction.md
  27. 2 2
      docs/zh/manuals/ios.md
  28. 1 1
      docs/zh/manuals/linux.md
  29. 110 110
      docs/zh/manuals/live-update.md
  30. 1 1
      docs/zh/manuals/macos.md
  31. 4 4
      docs/zh/manuals/material.md
  32. 1 1
      docs/zh/manuals/optimization.md
  33. 86 86
      docs/zh/manuals/particlefx.md
  34. 148 145
      docs/zh/manuals/physics.md
  35. 5 5
      docs/zh/manuals/project-settings.md
  36. 2 2
      docs/zh/manuals/render.md
  37. 71 71
      docs/zh/manuals/shader.md
  38. 1 1
      docs/zh/manuals/spinemodel.md
  39. 1 1
      docs/zh/manuals/texture-filtering.md
  40. 66 66
      docs/zh/manuals/texture-profiles.md
  41. 2 4
      docs/zh/manuals/web-monetization.md
  42. 1 1
      docs/zh/manuals/windows.md
  43. 2 2
      docs/zh/manuals/working-offline.md

+ 1 - 1
docs/zh/manuals/adapting-graphics-to-screen-size.md

@@ -25,7 +25,7 @@ Defold 渲染脚本提供整个渲染流程的控制. 渲染脚本控制着显
 
 ## 复古/8比特图像
 
-复古/8比特图像游戏模拟了老式游戏机或者低分辨率低调色盘的电脑游戏. 比如任天堂红白机 (NES) 就是分辨率 256x240 的, Commodore 64 是 320x200 的,  Gameboy 是 160x144 的, 这些屏幕分辨率赶不上当前屏幕的零头. 为了在当今高分辨率屏幕上模拟这种风格的游戏需要把屏幕缩放好几倍. 一个简单的方法是先显示低分辨率图像然后再在渲染时放大. 这在Defold中使用渲染脚本就能做到, [固定映射](/manuals/render/#固定映射) 可以设置一个合适的放大值.
+复古/8比特图像游戏模拟了老式游戏机或者低分辨率低调色盘的电脑游戏. 比如任天堂红白机 (NES) 就是分辨率 256x240 的, Commodore 64 是 320x200 的,  Gameboy 是 160x144 的, 这些屏幕分辨率赶不上当前屏幕的零头. 为了在当今高分辨率屏幕上模拟这种风格的游戏需要把屏幕缩放好几倍. 一个简单的方法是先显示低分辨率图像然后再在渲染时放大. 这在Defold中使用渲染脚本就能做到, [固定映射](/manuals/render/#Fixed) 可以设置一个合适的放大值.
 
 比如使用这个瓷砖图源和角色 ([source](https://ansimuz.itch.io/grotto-escape-game-art-pack)) 来模拟一个8位 320x200 分辨率游戏:
 

+ 1 - 1
docs/zh/manuals/ads.md

@@ -45,7 +45,7 @@ CPM = 千人成本. 广告商为一千个浏览量支付的报酬. 不同广告
 
 # 广告游戏整合
 
-决定好合作广告商就可以按步骤地植入广告资源了. 一般都要首先加入 [项目依赖](/manuals/libraries/#setting-up-library-dependencies). 之后载入广告资源, 展示广告内容.
+决定好合作广告商就可以按步骤地植入广告资源了. 一般都要首先加入 [项目依赖](/manuals/libraries/#设置库依赖). 之后载入广告资源, 展示广告内容.
 
 
 # 广告与内支付

+ 2 - 2
docs/zh/manuals/android.md

@@ -38,7 +38,7 @@ keytool -genkey -v -noprompt -dname "CN=John Smith, OU=Area 51, O=US Air Force,
 
 ## 安卓应用打包
 
-编辑器打包安卓包十分方便. 打包之前可以为应用指定图标, 设置版本号等等, 都在 "game.project" [项目配置文件](/manuals/project-settings/#android) 里设置.
+编辑器打包安卓包十分方便. 打包之前可以为应用指定图标, 设置版本号等等, 都在 "game.project" [项目配置文件](/manuals/project-settings/#Android) 里设置.
 
 选择菜单栏 <kbd>Project ▸ Bundle... ▸ Android Application...</kbd> 就可以打包了.
 
@@ -75,7 +75,7 @@ Success
 
 ## 权限
 
-Defold 引擎需要一些权限来运行各种功能. 权限在 `AndroidManifest.xml` 文件中定义, 并在 "game.project" [项目配置文件](/manuals/project-settings/#android) 中配置. 关于 Android 权限详见 [官方文档](https://developer.android.com/guide/topics/permissions/overview). 默认配置需要如下权限:
+Defold 引擎需要一些权限来运行各种功能. 权限在 `AndroidManifest.xml` 文件中定义, 并在 "game.project" [项目配置文件](/manuals/project-settings/#Android) 中配置. 关于 Android 权限详见 [官方文档](https://developer.android.com/guide/topics/permissions/overview). 默认配置需要如下权限:
 
 ### android.permission.INTERNET and android.permission.ACCESS_NETWORK_STATE (Protection level: normal)
 允许应用打开网络连接访问互联网. 需要上网时需要此权限. 见 ([Android 官方文档-网络](https://developer.android.com/reference/android/Manifest.permission#INTERNET)) 和 ([Android 官方文档-网络状态](https://developer.android.com/reference/android/Manifest.permission#ACCESS_NETWORK_STATE)).

+ 2 - 0
docs/zh/manuals/building-blocks.md

@@ -107,4 +107,6 @@ local parent = go.get_id("bean")
 msg.post("child_bean", "set_parent", { parent_id = parent })
 ```
 
+::: 注意
 一个常见的误解是对象层级改变了那么它的定位地址也会改变. 但是, 这其实是两码事. 父子关系改变的是场景的层级. 集合嵌套关系才决定对象地址. 在对象整个生命周期中, 地址是不会变化的.
+:::

+ 4 - 4
docs/zh/manuals/bundling.md

@@ -28,11 +28,11 @@ brief: 本教程介绍了如何打包应用.
 
 ### Android
 
-建立安卓应用 (.apk 文件) 详见 [安卓教程](/manuals/android/#creating-an-android-application-bundle).
+建立安卓应用 (.apk 文件) 详见 [安卓教程](/manuals/android/#安卓应用打包).
 
 ### iOS
 
-建立苹果移动应用 (.ipa 文件) 详见 [iOS 教程](/manuals/ios/#creating-an-ios-application-bundle).
+建立苹果移动应用 (.ipa 文件) 详见 [iOS 教程](/manuals/ios/#iOS应用打包).
 
 ### OSX
 
@@ -40,7 +40,7 @@ brief: 本教程介绍了如何打包应用.
 
 ### Linux
 
-建立Linux应用无需特别设置 "game.project" [项目配置文件](/manuals/project-settings/#linux).
+建立Linux应用无需特别设置.
 
 ### Windows
 
@@ -48,7 +48,7 @@ brief: 本教程介绍了如何打包应用.
 
 ### HTML5
 
-建立HTML5应用及其参数设置详见 [HTML5 教程](/manuals/html5/#打包html5应用).
+建立HTML5应用及其参数设置详见 [HTML5 教程](/manuals/html5/#HTML5游戏打包).
 
 #### Facebook Instant Games
 

+ 1 - 1
docs/zh/manuals/camera.md

@@ -5,7 +5,7 @@ brief: 本教程介绍了 Defold 摄像机组件的功能.
 
 # 摄像机
 
-Defold 的摄像机组件控制游戏世界的视口与映射. 摄像机组件定义了透视和平视的视口与映射矩阵用于渲染脚本进行渲染. 透视摄像机一般服务于 3D 游戏, 平视摄像机一般服务员 2D 游戏. 如果需要摄像机追随, 缩放, 震动之类的功能需要自己来实现 (可以参考下面的 [第三方摄像机解决方案](https://www.defold.com/manuals/camera/#third-party-camera-solutions)).
+Defold 的摄像机组件控制游戏世界的视口与映射. 摄像机组件定义了透视和平视的视口与映射矩阵用于渲染脚本进行渲染. 透视摄像机一般服务于 3D 游戏, 平视摄像机一般服务员 2D 游戏. 如果需要摄像机追随, 缩放, 震动之类的功能需要自己来实现 (可以参考下面的 [第三方摄像机解决方案](https://www.defold.com/manuals/camera/#第三方摄像机解决方案)).
 
 ## 创建摄像机
 

+ 1 - 1
docs/zh/manuals/collection-factory.md

@@ -11,7 +11,7 @@ Defold 提供了集合或者称为 "prefabs" 的可重用模板机制 . 关于
 
 使用集合工厂可以依照一个集合文件向游戏世界插入内容. 这与游戏对象工厂的做法类似只不过集合工厂能创建一组含有父子嵌套层级关系的游戏对象. 典型用法比如动态生成一组敌人 (敌人对象和其武器对象的组合).
 
-## 建集合
+## 建集合
 
 假设有一个角色对象, 在它的子集有个盾牌对象. 我们就可以把这种含嵌套层级关系的组合保存为一个集合文件 "bean.collection".
 

+ 42 - 42
docs/zh/manuals/collection-proxy.md

@@ -23,32 +23,32 @@ Defold 把所有游戏对象组织在集合里. 集合可以包含游戏对象
 
 ## 启动集合
 
-当 Defold 引擎开始工作最先把 *启动集合* 导入运行环境并对其中的所有游戏对象进行初始化. 然后开启游戏对象和它们的组件. 在 [项目配置](/manuals/project-settings/#main-collection) 里设置把哪个集合作为启动集合使用. 依照惯例启动集合都叫做 "main.collection".
+当 Defold 引擎开始工作最先把 *启动集合* 导入运行环境并对其中的所有游戏对象进行初始化. 然后开启游戏对象和它们的组件. 在 [项目配置](/manuals/project-settings/#Main Collection) 里设置把哪个集合作为启动集合使用. 依照惯例启动集合都叫做 "main.collection".
 
 ![bootstrap](images/collection-proxy/bootstrap.png){srcset="images/collection-proxy/[email protected] 2x"}
 
-To fit the game objects and their components the engine allocates the memory needed for the whole "game world" into which the contents of the bootstrap collection are instanciated. A separate physics world is also created for any collision objects and physics simulation.
+启动集合实例化时引擎会为 "游戏世界" 里的游戏对象和组件分配足够的内存空间. 对于物理模拟和碰撞对象, 引擎会为其建立另一个游戏世界.
 
-Since script components need to be able to address all objects in the game, even from outside the bootstrap world, it is given a unique name: the *Name* property that you set in the collection file:
+因为脚本要能定位任何地方的游戏对象, 包括启动集合之外的集合里的对象, 所以集合必须有独立的属性: *Name*:
 
 ![bootstrap](images/collection-proxy/collection_id.png){srcset="images/collection-proxy/[email protected] 2x"}
 
-If the collection that is loaded contains collection proxy components, the collections that those refer to are *not* loaded automatically. You need to control the loading of these resources through scripts.
+如果被加载集合里还有集合代理, 代理引用的集合 *不会* 被自动加载. 需要手动写代码进行加载.
 
-## Loading a collection
+## 载入集合
 
-Dynamically loading a collection via proxy is done by sending a message called `"load"` to the proxy component from a script:
+通过代理动态载入集合需要用脚本给代理发送 `"load"` 消息:
 
 ```lua
--- Tell the proxy "myproxy" to start loading.
+-- 让代理 "myproxy" 开始加载集合.
 msg.post("#myproxy", "load")
 ```
 
 ![load](images/collection-proxy/proxy_load.png){srcset="images/collection-proxy/[email protected] 2x"}
 
-The proxy component will instruct the engine to allocate space for a new world. A separate runtime physics world is also created and all the game objects in the collection "mylevel.collection" are instantiated.
+集合代理会告诉引擎需要为新游戏世界分配多大空间内存. 另一个物理世界也被建立起来连同集合 "mylevel.collection" 里的游戏对象都会被实例化.
 
-The new world gets its name from the *Name* property in the collection file, in this example it is set to "mylevel". The name has to be unique. If the *Name* set in the collection file is already used for a loaded world, the engine will signal a name collision error:
+新游戏世界的创建通过 *Name* 属性引用的集合文件为蓝图, 本例中是 "mylevel". 不能有重名. 如果集合文件 *Name* 重名, 引擎会报错:
 
 ```txt
 ERROR:GAMEOBJECT: The collection 'default' could not be created since there is already a socket with the same name.
@@ -56,12 +56,12 @@ WARNING:RESOURCE: Unable to create resource: build/default/mylevel.collectionc
 ERROR:GAMESYS: The collection /mylevel.collectionc could not be loaded.
 ```
 
-When the engine has finished loading the collection, the collection proxy component will send a message named `"proxy_loaded"` back to the script that sent the `"load"` message. The script can then initialize and enable the collection as a reaction to the message:
+当集合加载完毕, 集合代理会向发送 `"load"` 消息的脚本发回 `"proxy_loaded"` 消息. 收到此消息就可以进行集合初始化等工作了:
 
 ```lua
 function on_message(self, message_id, message, sender)
     if message_id == hash("proxy_loaded") then
-        -- New world is loaded. Init and enable it.
+        -- 新集合已加载完毕. 初始化并激活它.
         msg.post(sender, "init")
         msg.post(sender, "enable")
         ...
@@ -70,74 +70,74 @@ end
 ```
 
 `"load"`
-: This message tells the collection proxy component to start loading its collection into a new world. The proxy will send back a message called `"proxy_loaded"` when it's done.
+: 此消息通知集合代理组件开始为新游戏世界加载集合. 完成后会发送 `"proxy_loaded"` 消息.
 
 `"async_load"`
-: This message tells the collection proxy component to start background loading its collection into a new world. The proxy will send back a message called `"proxy_loaded"` when it's done.
+: 此消息通知集合代理组件开始在后台为新游戏世界加载集合. 完成后会发送 `"proxy_loaded"` 消息.
 
 `"init"`
-: This message tells the collection proxy component that all the game objects and components that has been instantiated should be initialized. All script `init()` functions are called at this stage.
+: 此消息通知集合代理组件集合里的游戏对象和组件已实例化完毕, 可以进行初始化了. 此时所有脚本里的 `init()` 函数会被调用.
 
 `"enable"`
-: This message tells the collection proxy component that all the game objects and components should be enabled. All sprite components begin to draw when enabled, for instance.
+: 此消息通知集合代理组件集合里的游戏对象和组件已实例化完毕, 可以激活它们了. 此时会进行sprite渲染等等工作.
 
-## Addressing into the new world
+## 新游戏世界定位
 
-The *Name* set in the collection file properties is used to address game objects and components in the loaded world. If you, for instance, create a loader object in the bootstrap collection you may need to communicate with it from any loaded collection:
+使用集合文件的 *Name* 属性用来定位其中的游戏对象和组件. 比如启动集合里有个加载器对象, 一关结束后让它加载下一关:
 
 ```lua
--- tell the loader to load the next level:
+-- 告诉加载器加载下一关:
 msg.post("main:/loader#script", "load_level", { level_id = 2 })
 ```
 
 ![load](images/collection-proxy/message_passing.png){srcset="images/collection-proxy/[email protected] 2x"}
 
-## Unloading a world
+## 新游戏世界卸载
 
-To unload a loaded collection, you send messages corresponding to the converse steps of the loading:
+卸载需要发送的消息和加载相反:
 
 ```lua
--- unload the level
+-- 卸载当前关卡
 msg.post("#myproxy", "disable")
 msg.post("#myproxy", "final")
 msg.post("#myproxy", "unload")
 ```
 
 `"disable"`
-: This message tells the collection proxy component to disable all the game object and components in the world. Sprites stop being rendered at this stage.
+: 此消息通知集合代理组件关闭游戏对象和组件. 此时sprite不再进行渲染工作.
 
 `"final"`
-: This message tells the collection proxy component to finalize all the game object and components in the world. All scripts' `final()` functions are called at this stage.
+: 此消息通知集合代理组件析构游戏对象和组件. 此时所有脚本里的 `final()` 函数会被调用.
 
 `"unload"`
-: This message tells the collection proxy to remove the world completely from memory.
+: 此消息通知集合代理组件把游戏世界从内存中清除.
 
-If you don’t need the finer grained control, you can send the `"unload"` message directly without first disabling and finalizing the collection. The proxy will then automatically disable and finalize the collection before it’s unloaded.
+如果不那么细致, 只发送 `"unload"` 消息就好. 在卸载前代理会自动进行关闭和析构工作.
 
-When the collection proxy has finished unloading the collection it will send a `"proxy_unloaded"` message back to the script that sent the `"unload"` message:
+当即和卸载完毕, 集合代理会向发送 `"unload"` 消息的脚本发回 `"proxy_unloaded"` 消息:
 
 ```lua
 function on_message(self, message_id, message, sender)
     if message_id == hash("proxy_unloaded") then
-        -- Ok, the world is unloaded...
+        -- Ok, 游戏世界卸载完成...
         ...
     end
 end
 ```
 
 
-## Time step
+## 时间步
 
-Collection proxy updates can be scaled by altering the _time step_. This means that even though the game ticks at a steady 60 FPS, a proxy can update at a higher or lower pace, affecting physics and the `dt` variable passed to `update()`. You can also set the update mode, which allows you to control if the scaling should be performed discretely (which only makes sense with a scale factor below 1.0) or continuously.
+集合代理的更新周期可以使用 _time step_ 进行缩放. 也就是说即使游戏是 60 FPS 的, 代理游戏世界的速度可以更快或者更慢, 影响物理世界和 `update()` 函数的 `dt` 参数. 还可以设置更新执行模式, 用以确定这种时间缩放是断续执行 (缩放值小于 1.0 时才有意义) 还是持续执行.
 
-You control the scale factor and the scaling mode by sending the proxy a `set_time_step` message:
+通过发送 `set_time_step` 消息给集合代理组件来设置时间步缩放系数与执行模式:
 
 ```lua
--- update loaded world at one-fifth-speed.
+-- 把加载的游戏世界时间放慢为1/5.
 msg.post("#myproxy", "set_time_step", {factor = 0.2, mode = 1}
 ```
 
-To see what's happening when changing the time step, we can create an object with the following code in a script component and put it in the collection we're altering the timestep of:
+这样做的结果, 我们可以通过一段代码来进行观察:
 
 ```lua
 function update(self, dt)
@@ -145,7 +145,7 @@ function update(self, dt)
 end
 ```
 
-With a time step of 0.2, we get the following result in the console:
+时间步系数为 0.2, 控制台打印如下输出:
 
 ```txt
 INFO:DLIB: SSDP started (ssdp://192.168.0.102:54967, http://0.0.0.0:62162)
@@ -163,17 +163,17 @@ DEBUG:SCRIPT: update() with timestep (dt) 0
 DEBUG:SCRIPT: update() with timestep (dt) 0.016666667535901
 ```
 
-`update()` is still called 60 times a second, but the value of `dt` changes. We see that only 1/5 (0.2) of the calls to `update()` will have a `dt` of 1/60 (corresponding to 60 FPS)---the rest is zero. All physics simulations will also be updated according to that dt and advance only in one fifth of the frames.
+`update()` 仍然是每秒调用 60 次, 但是 `dt` 值变了. 可以看到只有 1/5 (0.2) 的 `update()` 调用包含 1/60 秒的 `dt` 参数, 其他都是 0. 物理模拟也基于 dt 每 5 帧步进一次.
 
-See [`set_time_step`](/ref/collectionproxy#set_time_step) for more details.
+详情请见 [`set_time_step`](/ref/collectionproxy#set_time_step).
 
-## Caveats and common issues
+## 注意事项与常见问题
 
-Physics
-: Through collection proxies it is possible to load more than one top level collection, or *game world* into the engine. When doing so it is important to know that each top level collection is a separate physical world. Physics interactions (collisions, triggers, ray-casts) only happen between objects belonging to the same world. So even if the collision objects from two worlds visually sits right on top of each other, there cannot be any physics interaction between them.
+物理
+: 通过集合代理可以导入多个集合, 或称 *游戏世界*. 要注意的是每个顶级集合都有自己的物理世界. 物理交互 (碰撞, 触发, 射线) 只发生与同一物理世界的物体之间. 所以即使分别来自两个游戏世界的两个物体即使被放在一起, 也不会有碰撞发生.
 
-Memory
-: Each loaded collection creates a new game world which comes with a relatively large memory footprint. If you load dozens of collections simultaneously through proxies, you might want to reconsider your design. To spawn many instances of game object hierarchies, [collection factories](/manuals/collection-factory) are more suitable.
+内存
+: 被载入的游戏世界都要占不少内存. 如果同时加载了很多集合, 推荐优化你的游戏规则. 创建多个游戏对象实例的话, [集合工厂](/manuals/collection-factory) 更加适用.
 
-Input
-: If you have objects in your loaded collection that require input actions, you need to make sure that the game object that contains the collection proxy acquires input. When the game object receives input messages these are propagated to the components of that object, i.e. the collection proxies. The input actions are sent via the proxy into the loaded collection.
+输入
+: 要让集合里的游戏对象获得输入信息, 首先要确保集合代理所在的游戏对象获得了输入焦点. 当游戏对象收到输入消息时, 这些消息将传播到该对象的组件也就是集合代理中去. 输入动作通过集合代理下发到其载入的集合里.

+ 2 - 2
docs/zh/manuals/components.md

@@ -54,7 +54,7 @@ msg.post("#weapon", "enable")
 
 ## 组件属性
 
-Defold 组件属性各不相同.在 [Outline 视图](/manuals/editor/#编辑器视图) 中当前选中的组件属性会显示在编辑器的 [Properties 面板](/manuals/editor/#the-editor-views) 中. 可用组件的详细属性详情请见API教程.
+Defold 组件属性各不相同.在 [Outline 面板](/manuals/editor/#Outline 面板) 中当前选中的组件属性会显示在编辑器的 [Properties 面板](/manuals/editor/#Properties 面板) 中. 可用组件的详细属性详情请见API教程.
 
 ## 位置, 旋转和缩放
 
@@ -67,7 +67,7 @@ Defold 组件属性各不相同.在 [Outline 视图](/manuals/editor/#编辑器
 可视组件的渲染顺序取决于两个方面:
 
 ### 渲染脚本的渲染优先级
-每个组件都有 [材质](/manuals/material/) 而且每个材质都有一个或多个标签. 渲染脚本依次定义一系列优先级, 每个优先级匹配一个或多个材质标签. 渲染脚本在 *update()* 函数里 [按优先级依次渲染](/manuals/render/#render-predicates) , 匹配优先级标签的组件会被显示出来. 默认渲染脚本先绘制 sprites 和 tilemaps, 再渲染粒子特效, 二者都使用世界坐标系. 最后渲染脚本会在屏幕坐标系中渲染 GUI 组件.
+每个组件都有 [材质](/manuals/material/) 而且每个材质都有一个或多个标签. 渲染脚本依次定义一系列优先级, 每个优先级匹配一个或多个材质标签. 渲染脚本在 *update()* 函数里 [按优先级依次渲染](/manuals/render/#渲染优先级) , 匹配优先级标签的组件会被显示出来. 默认渲染脚本先绘制 sprites 和 tilemaps, 再渲染粒子特效, 二者都使用世界坐标系. 最后渲染脚本会在屏幕坐标系中渲染 GUI 组件.
 
 ### 组件z值
 所有游戏对象都使用一个 vector3 作为其在 3D 空间中的位置. 如果是 2D 游戏, 则 X 和 Y 表示其在 "横向" 和 "纵向" 轴上的位置, 而 Z 值表示其在 "深度" 轴上的位置. 使用Z值可以操控游戏对象之间的层叠关系: Z 值是 1 的总是显示在 Z 值是 0 的对象上面. 默认情况下, Defold 使用 Z 值范围是 -1 到 1:

+ 1 - 1
docs/zh/manuals/debugging-native-code.md

@@ -55,7 +55,7 @@ Defold 几经测试鲜有崩溃情况出现. 但是崩溃这种事谁能保证
 
 #### Android
 
-如果应用是 [可调式的](/manuals/project-settings/#android), 就可以使用 [Android Debug Bridge (ADB) 工具](https://developer.android.com/studio/command-line/adb.html) 和 `adb shell` 命令得到崩溃日志:
+如果应用是 [可调式的](/manuals/project-settings/#Android), 就可以使用 [Android Debug Bridge (ADB) 工具](https://developer.android.com/studio/command-line/adb.html) 和 `adb shell` 命令得到崩溃日志:
 
 ```
 	$ adb shell "run-as com.defold.example sh -c 'cat /data/data/com.defold.example/files/_crash'" > ./_crash

+ 1 - 1
docs/zh/manuals/dev-app.md

@@ -13,7 +13,7 @@ brief: 本教程介绍了如何在设备上安装开发用app以方便开发流
 
 ### 在 iOS 上安装
 
-打包成 Debug 变体的 iOS 应用可以用作开发用app. 推荐就使用你当前的项目打包成 Debug 变体就好. 这样可以保证你的应用使用了正确的项目设置和 [原生扩展](/manuals/extensions/). 关于如何打包ios应用详情请见 [iOS 教程](/manuals/ios/#creating-an-ios-application-bundle). 记得使用 Debug 变体!
+打包成 Debug 变体的 iOS 应用可以用作开发用app. 推荐就使用你当前的项目打包成 Debug 变体就好. 这样可以保证你的应用使用了正确的项目设置和 [原生扩展](/manuals/extensions/). 关于如何打包ios应用详情请见 [iOS 教程](/manuals/ios/#iOS应用打包). 记得使用 Debug 变体!
 
 ### 在 Android 上安装
 

+ 15 - 1
docs/zh/manuals/editor.md

@@ -231,4 +231,18 @@ Defold 编辑器被划分为许多面板, 或称视图, 以展示和编辑数据
 | Up | <kbd>Up</kbd> | <kbd>Up</kbd> | <kbd>Up</kbd> |
 | Up major | <kbd>Shift</kbd>+<kbd>Up</kbd> | <kbd>Shift</kbd>+<kbd>Up</kbd> | <kbd>Shift</kbd>+<kbd>Up</kbd> |
 | Zoom in | <kbd>Ctrl</kbd>+<kbd>'</kbd>+<kbd>'</kbd> | <kbd>Cmd</kbd>+<kbd>'</kbd>+<kbd>'</kbd> | <kbd>Ctrl</kbd>+<kbd>'</kbd>+<kbd>'</kbd> |
-| Zoom out | <kbd>Ctrl</kbd>+<kbd>'-'</kbd> | <kbd>Cmd</kbd>+<kbd>'-'</kbd> | <kbd>Ctrl</kbd>+<kbd>'-'</kbd> |
+| Zoom out | <kbd>Ctrl</kbd>+<kbd>'-'</kbd> | <kbd>Cmd</kbd>+<kbd>'-'</kbd> | <kbd>Ctrl</kbd>+<kbd>'-'</kbd> |
+
+
+## 编辑器日志
+使用编辑器时如果遇到了麻烦可以 [向我们汇报](/manuals/getting-help/#获得帮助), 并且连同编辑器日志一起上报. 编辑器日志存放路径如下:
+
+  * Windows: `C:\Users\ **Your Username** \AppData\Local\Defold`
+  * macOS: `/Users/ **Your Username** /Library/Application Support/` 或 `~/Library/Application Support/Defold`
+  * Linux: `~/.Defold`
+
+如果用命令行启动编辑器那么日志会显示在控制台上. 例如从 macOS 终端启动 Defold 编辑器:
+
+```
+$ > ./path/to/Defold.app/Contents/MacOS/Defold
+```

+ 1 - 1
docs/zh/manuals/extension-facebook.md

@@ -72,7 +72,7 @@ Android 平台需要填写 *Google Play Package Name*, 也就是 *game.project*
 $ cat certificate.pem | openssl x509 -outform der | openssl sha1 -binary | openssl base64
 ```
 
-(关于签名文件详细信息参见 [创建证书和密匙](/manuals/android/#creating-certificates-and-keys).)
+(关于签名文件详细信息参见 [制作 keystore](/manuals/android/#制作 keystore).)
 
 ![Android settings](images/facebook/settings_android.png)
 

+ 3 - 3
docs/zh/manuals/extension-fbinstant.md

@@ -25,7 +25,7 @@ Instant Games 可以让玩家在 Facebook 平台上随时玩到游戏的新方
    <script src="https://connect.facebook.net/en_US/fbinstant.6.3.js"></script>
    ```
 
-   关于打包设置详情请见 [HTML5 教程](/manuals/html5/#自定义html5打包).
+   关于打包设置详情请见 [HTML5 教程](/manuals/html5/#自定义HTML5打包).
 
 4. 都准备好之后, 打包 HTML5 游戏并上传至 Facebook.
 
@@ -68,7 +68,7 @@ end)
 Facebook Instant Games [最佳实践](https://developers.facebook.com/docs/games/instant-games/best-practices) 建议游戏首次载入时间不得超过5秒. 这对 Defold 来说有点勉强, 好在还有一些方法能减小游戏体积:
 
 去掉未使用引擎特性
-: HTML5 版的标准 Defold 引擎用gzip压缩后小于 1.2MB, 但是可以通过去掉不必要的引擎特效来达到减少包体的效果. 在 "app.manifest" 文件中可以指定去掉引擎哪方面特性, 此文件在 "game.project" 文件的 [Native Extension 部分](/manuals/project-settings/#原生扩展) 引用.
+: HTML5 版的标准 Defold 引擎用gzip压缩后小于 1.2MB, 但是可以通过去掉不必要的引擎特效来达到减少包体的效果. 在 "app.manifest" 文件中可以指定去掉引擎哪方面特性, 此文件在 "game.project" 文件的 [Native Extension 部分](/manuals/project-settings/#Native extension) 引用.
 
   此功能尚处于测试阶段且没有说明文档. 这里: https://forum.defold.com/t/stripping-appmanifest-maker/16059 有一个可以自动生成 app.manifests 文件的工具.
 
@@ -82,4 +82,4 @@ Facebook Instant Games [最佳实践](https://developers.facebook.com/docs/games
 
 ## 已知问题
 
-关于 HTML5 和 Instant Games 的已知问题详见 [HTML5 教程已知问题部分](/manuals/html5/#known-issues-and-limitations).
+关于 HTML5 和 Instant Games 的已知问题详见 [HTML5 教程已知问题部分](/manuals/html5/#已知问题和局限性).

+ 1 - 1
docs/zh/manuals/extensions-best-practices.md

@@ -96,7 +96,7 @@ Defold 引擎不支持 STL 代码, 除了某些算法和数学库 (std::sort, st
             /res                         -- 平台需要的资源文件
             /external
                 README.md                -- 扩展相关编译打包的说明/脚本
-        /bundleres                       -- 需要打包的资源 (参见 game.project 以及 [bundle_resources 设置](/manuals/project-settings/#project))
+        /bundleres                       -- 需要打包的资源 (参见 game.project 以及 [bundle_resources 设置](/manuals/project-settings/#Project))
             /<platform>
         game.project
         game.appmanifest                 -- 其他应用设置

+ 2 - 2
docs/zh/manuals/extensions-debugging.md

@@ -5,7 +5,7 @@ brief: 本教程介绍了一些调试包含原生扩展程序应用的方法.
 
 # 调试原生扩展
 
-开发原生扩展程序的时候总会碰到这样那样的问题比如在编译服务器上编译不通过或者应用里扩展程序无效等等.
+开发原生扩展程序的时候总会碰到这样那样的问题,比如在编译服务器上编译不通过或者应用里扩展程序无效等等.
 
 ## 报错调试
 
@@ -80,7 +80,7 @@ brief: 本教程介绍了一些调试包含原生扩展程序应用的方法.
 
 adb 可以显示此文件在哪 (不同设备保存位置不同)
 
-如果应用是 [可调试的](https://www.defold.com/manuals/project-settings/#android), 可以这样获取崩溃日志:
+如果应用是 [可调试的](https://www.defold.com/manuals/project-settings/#Android), 可以这样获取崩溃日志:
 
 ```
 	$ adb shell "run-as com.defold.adtest sh -c 'cat /data/data/com.defold.adtest/files/_crash'" > ./_crash

+ 2 - 2
docs/zh/manuals/file-access.md

@@ -28,9 +28,9 @@ Defold 提供如下函数用以存取文件/文件夹:
 ### 游戏应用打包进去的文件处理
 游戏打包有两种方法:
 
-1. 在 *game.project* 配置文件中的 [*Custom Resources* 项](https://defold.com/manuals/project-settings/#project) 设置自定义资源. 然后就可以使用 [`sys.load_resource()`](https://defold.com/ref/sys/#sys.load_resource) 函数进行加载. 其实这不是在加载磁盘上的文件. 打包进游戏的资源文件作为游戏的一部分保存为二进制数据, 只能使用 `sys.load_resource()` 载入.
+1. 在 *game.project* 配置文件中的 [*Custom Resources* 项](https://defold.com/manuals/project-settings/#Project) 设置自定义资源. 然后就可以使用 [`sys.load_resource()`](https://defold.com/ref/sys/#sys.load_resource) 函数进行加载. 其实这不是在加载磁盘上的文件. 打包进游戏的资源文件作为游戏的一部分保存为二进制数据, 只能使用 `sys.load_resource()` 载入.
 
-2. 在 *game.project* 配置文件中的 [*Bundle Resources* 项](https://defold.com/manuals/project-settings/#project) 设置额外打包文件. 然后就可以使用 [`sys.get_application_path()`](https://defold.com/ref/stable/sys/#sys.get_application_path:) 取得游戏所在位置. 进而取得文件的绝对路径. 然后用 `sys.*`, `io.*` 和 `os.*` 函数处理文件/文件夹 (见上文).
+2. 在 *game.project* 配置文件中的 [*Bundle Resources* 项](https://defold.com/manuals/project-settings/#Project) 设置额外打包文件. 然后就可以使用 [`sys.get_application_path()`](https://defold.com/ref/stable/sys/#sys.get_application_path:) 取得游戏所在位置. 进而取得文件的绝对路径. 然后用 `sys.*`, `io.*` 和 `os.*` 函数处理文件/文件夹 (见上文).
 
 ### 操作系统文件处理
 基于安全考虑操作系统所管理的文件存取被严格限制. 可以使用 [`extension-directiories`](https://defold.com/assets/extensiondirectories/) 原生扩展来存取某些地方的绝对路径 (例如 documents, resource, temp). 然后用 `sys.*`, `io.*` 和 `os.*` 函数处理文件/文件夹 (见上文).

+ 2 - 2
docs/zh/manuals/flash.md

@@ -238,7 +238,7 @@ Defold 包含一个 Box2D 物理引擎的修改版, 可以用来自动模拟真
 
 注意 *Group* 属性设置为了 "target" 然后 *Mask* 设置为了 "bullet".
 
-Flash 里, 需要脚本调用才会进行碰撞检测. Defold 里, 只要碰撞对象开启, 后台就会持续进行碰撞检测. 碰撞发生时, 消息会发送到游戏对象所有组件上 (更确切地说是脚本组件). 有 [碰撞处理和碰撞点处理](/manuals/physics/#collision-messages) 消息, 其中包含了处理碰撞所需的各种信息.
+Flash 里, 需要脚本调用才会进行碰撞检测. Defold 里, 只要碰撞对象开启, 后台就会持续进行碰撞检测. 碰撞发生时, 消息会发送到游戏对象所有组件上 (更确切地说是脚本组件). 有 [碰撞处理和碰撞点处理消息](/manuals/physics/#碰撞消息), 其中包含了处理碰撞所需的各种信息.
 
 Defold 的碰撞检测比 Flash 的要高级, 毫不费力就能检测复杂形状间的碰撞. 碰撞检测是自动的, 也就是说不需要手动遍历各个对象然后挨个进行碰撞检测. 但是没有 Flash 的 shapeFlag. 但是对于复杂图形可以使用简单图形组合达成. 更复杂的需求下, 还可以使用 [自定义图形](//forum.defold.com/t/does-defold-support-only-three-shapes-for-collision-solved/1985).
 
@@ -268,7 +268,7 @@ on_input
 on_reload
 :   脚本组件重载时调用.
 
-这些都是可选回调函数如果不需要可以删除. 关于如何接收输入, 详情请见 [输入教程](/manuals/input). 有一个关于集合代理易用错的地方 - 详情请见输入教程的 [这一章](/manuals/input/#input-dispatch-and-on_input).
+这些都是可选回调函数如果不需要可以删除. 关于如何接收输入, 详情请见 [输入教程](/manuals/input). 有一个关于集合代理易用错的地方 - 详情请见输入教程的 [这一章](/manuals/input/#输入调度和 on_input() 函数).
 
 就像碰撞检测部分说的那样, 碰撞事件被发送到相关游戏对象上进行处理. 各个脚本组件的 on_message 回调函数会被调用.
 

+ 1 - 4
docs/zh/manuals/getting-help.md

@@ -73,8 +73,5 @@ brief: 本教程介绍了使用 Defold 遇到麻烦时该如何寻求帮助.
 游戏引擎, 编辑器和云编译服务器都有日志系统, 这对于定位调试错误十分有利. 报告错误时请务必带上日志文件.
 
 * [引擎日志](/manuals/debugging-game-and-system-logs)
-* 编辑器日志
-  * Windows: `C:\Users\ **Your Username** \AppData\Local\Defold`
-  * macOS: `/Users/ **Your Username** /Library/Application Support/` 或 `~/Library/Application Support/Defold`
-  * Linux: `~/.Defold`
+* [Editor logs](/manuals/editor#editor-logs)
 * [编译服务器日志](/manuals/extensions#build-server-logs)

+ 1 - 1
docs/zh/manuals/glossary.md

@@ -5,7 +5,7 @@ brief: 本教程列举了使用 Defold 工作中会遇到的各种专用词汇
 
 # Defold 术语
 
-该名词表简要介绍了您在 Defold 中遇到的各种术语。在大多数情况下,您会找到更多相关详细文档的链接。
+该名词表简要介绍了您在 Defold 中遇到的各种术语.在大多数情况下,您会找到更多相关详细文档的链接.
 
 ## Animation set
 

+ 1 - 1
docs/zh/manuals/gui-layouts.md

@@ -5,7 +5,7 @@ brief: Defold 支持让 GUIs 自动适配手机屏幕方向的改变. 本教程
 
 # 布局
 
-Defold支持可自动适应移动设备上屏幕方向变化的GUI。通过使用此功能,您可以设计适合各种屏幕尺寸的方向和纵横比的GUI。也可以创建与特定设备型号匹配的布局。
+Defold支持可自动适应移动设备上屏幕方向变化的GUI.通过使用此功能,您可以设计适合各种屏幕尺寸的方向和纵横比的GUI.也可以创建与特定设备型号匹配的布局.
 
 ## 新建显示档案
 

+ 136 - 136
docs/zh/manuals/gui.md

@@ -9,289 +9,289 @@ Defold 提供了 GUI 编辑器以及与之配套的脚本用以实现用户界
 
 Defold 的图形用户界面是被放在集合里的, 依附于游戏对象的 GUI 组件. 这种组件有如下特点:
 
-* It has simple, but powerful, layout features that allow resolution and aspect ratio independent rendering of your user interface.
-* It can have logic behavior attached to it through a *GUI script*.
-* It is (by default) rendered on top of other content, independent of camera view so even if you have a moving camera, your GUI elements will stay put on the screen. The rendering behavior can be changed.
+* 简单且功能强大的布局功能, 可以适配各种分辨率和纵横比的屏幕
+* 通过 *GUI 脚本* 进行逻辑控制.
+* 界面 (默认) 被渲染于其他内容之上, 于视口摄像机无关, GUI 始终保持最上端显示. 这种特性可以根据需要手动修改.
 
-GUI components are rendered independently of the game view. Because of this it is not placed in a particular location in the collection editor, nor does it have a visual representation in the collection editor. However, GUI components have to reside in a game object that has a location in a collection. Changing that location has no effect on the GUI.
+界面独立于游戏内容. 所以集合编辑器里并不显示界面元素. 但是界面必须依附于一个游戏对象而这个游戏对象要被放在集合里. 具体放在集合什么位置上并不影响界面的位置.
 
-## Creating a GUI component
+## 创建界面文件
 
-GUI components are created from a GUI scene blueprint file. To to create a new GUI component, <kbd>right click</kbd> a location in the *Assets* browser and select <kbd>New ▸ Gui</kbd>. Type a name for the new GUI file and press <kbd>Ok</kbd>.
+GUI 的创建基于一个模板文件. 要新建GUI文件, 在 *Assets* 浏览器中 <kbd>右键点击</kbd> 然后选择 <kbd>New ▸ Gui</kbd>. 为文件命名然后点击 <kbd>Ok</kbd>.
 
 ![New gui file](images/gui/new_gui_file.png){srcset="images/gui/[email protected] 2x"}
 
-Defold now automatically opens the file in the GUI scene editor.
+Defold 会自动启动场景编辑器打开这个文件.
 
 ![New gui](images/gui/new_gui.png){srcset="images/gui/[email protected] 2x"}
 
-The *Outline* lists all the GUI:s content: it's list of nodes and any dependencies (see below).
+*大纲* 视图里列出了所有 GUI:s 内容: 节点及其资源列表(见下文).
 
-The central editing area shows the GUI. The toolbar in the top right corner of the editing area contains *Move*, *Rotate* and *Scale* tools, as well as a [layout](/manuals/gui-layouts) selector.
+中间编辑区显示 GUI. 右上角的工具栏有 *移动*, *旋转* 和 *缩放* 工具, 以及一个 [布局](/manuals/gui-layouts) 选择器.
 
 ![toolbar](images/gui/toolbar.png){srcset="images/gui/[email protected] 2x"}
 
-A white rectangle shows the bounds of the currently selected layout, of the default display width and height as set in the project settings.
+当前布局用白色方框表示, 其宽度高度是在项目配置文件里设置的.
 
-Selecting the root "Gui" node in the *Outline* shows the *Properties* for the GUI component:
+在 *大纲* 视图中选中根节点 "Gui" 就会显示出当前GUI的 *属性*:
 
 Script
-: The GUI script bound to this GUI component.
+: 当前界面的GUI脚本.
 
 Material
-: The material used when rendering this GUI.
+: 当前界面的渲染用材质.
 
 Adjust Reference
-: Controls how each node's *Adjust Mode* should be calculated:
+: 控制节点的 *Adjust Mode* 算法:
 
-  - `Per Node` adjusts each node against the adjusted size of the parent node, or the resized screen.
-  - `Disable` turns off node adjust mode. This forces all nodes to keep their set size.
+  - `Per Node` 当父节点或屏幕大小改变时, 调整各个节点大小.
+  - `Disable` 关闭调整. 各个节点保持不变.
 
 Max Nodes
-: The maximum number of nodes for this GUI.
+: 界面最大节点数.
 
-## Dependencies
+## 资源
 
-The resource tree in a Defold game is static so any dependences that you need for your GUI nodes need to be added to the component. The *Outline* groups all dependencies by type under "folders":
+界面的结构与集合不同, 是分门别类的. *Outline* 视图中可以看到所有资源都被按照其类型分配到 "子文件夹" 下:
 
 ![dependencies](images/gui/dependencies.png){srcset="images/gui/[email protected] 2x"}
 
-To add a new dependency, <kbd>right click</kbd> the "Gui" root in the *Outline*, then select <kbd>Add ▸ [type]</kbd> from the popup context menu.
+要添加资源, <kbd>右键点击k</kbd> *Outline* 里的 "Gui" 根节点, 然后从上下文菜单中选择 <kbd>Add ▸ [资源类型]</kbd>.
 
-You can also <kbd>right click</kbd> on the folder icon for the type you want to add and select <kbd>Add ▸ [type]</kbd>.
+也可以在相应类型文件夹上 <kbd>右键点击</kbd> 然后选择 <kbd>Add ▸ [资源类型]</kbd>.
 
-## Node types
+## 节点类型
 
-A GUI component is built from a set of nodes. Nodes are simple elements. They can be translated (moved, scaled and rotated) and ordered in parent-child hierarchies either in the editor or at runtime through scripting. The following node types exist:
+界面有节点组成. 节点是一种类似游戏对象的元素. 可以进行位移 (移动, 旋转和缩放) 并且以父子树形结构排列. 有以下几种节点类型:
 
 Box node
 : ![box node](images/icons/gui-box-node.png){.left}
-  Rectangular node with either a single color, texture or flip-book animation. See the [Box node documentation](/manuals/gui-box) for details.
+  显示为纯色, 纹理或者逐帧动画的矩形. 详情请见 [方块节点教程](/manuals/gui-box).
 
 <div style="clear: both;"></div>
 
 Text node
 : ![text node](images/icons/gui-text-node.png){.left}
-  Displays text. See the [Text node documentation](/manuals/gui-text) for details.
+  显示文字. 详情请见 [文本节点教程](/manuals/gui-text).
 
 <div style="clear: both;"></div>
 
 Pie node
 : ![pie node](images/icons/gui-pie-node.png){.left}
-  A circular or ellipsoid node that can be partially filled or inverted. A See the [Pie node documentation](/manuals/gui-pie) for details.
+  圆形或椭圆饼图. 详情请见 [饼图节点教程](/manuals/gui-pie).
 
 <div style="clear: both;"></div>
 
 Template node
 : ![template node](images/icons/gui.png){.left}
-  Templates are used to create instances based on other GUI scene files. See the [Template node documentation](/manuals/gui-template) for details.
+  模板用来基于其他界面文件创建节点实例. 详情请见 [模板节点教程](/manuals/gui-template).
 
 <div style="clear: both;"></div>
 
 Spine node
 : ![spine node](images/icons/spine-model.png){.left}
-  Displays and animates a spine model. See the [Spine node documentation](/manuals/gui-spine) for details.
+  显示spine模型和动画. 详情请见 [Spine 节点教程](/manuals/gui-spine).
 
 <div style="clear: both;"></div>
 
 ParticleFX node
 : ![particlefx node](images/icons/particlefx.png){.left}
-  Plays a particle effect. See the [ParticleFX node documentation](/manuals/gui-particlefx) for details.
+  显示粒子特效. 详情请见 [粒子特效节点教程](/manuals/gui-particlefx).
 
 <div style="clear: both;"></div>
 
-Add nodes by right-clicking on the *Nodes* folder and selecting <kbd>Add ▸</kbd> and then <kbd>Box</kbd>, <kbd>Text</kbd>, <kbd>Pie</kbd>, <kbd>Template</kbd>, <kbd>Spine</kbd> or <kbd>ParticleFx</kbd>.
+右键点击 *Nodes* 文件夹选择 <kbd>Add ▸</kbd> 然后点击 <kbd>Box</kbd>, <kbd>Text</kbd>, <kbd>Pie</kbd>, <kbd>Template</kbd>, <kbd>Spine</kbd> 或 <kbd>ParticleFx</kbd> 即可创建节点.
 
 ![Add nodes](images/gui/add_node.png){srcset="images/gui/[email protected] 2x"}
 
-You can also press <kbd>A</kbd> and select the type you want to add to the GUI.
+还可以用快捷键 <kbd>A</kbd> 来创建节点.
 
-## Node properties
+## 节点属性
 
-Each node has an extensive set of properties that control its appearance:
+节点有自身属性:
 
 Id
-: The identity of the node. This name has to be unique within the GUI scene.
+: 节点id. 每个id是这个界面中的唯一值.
 
 Position, Rotation and Scale
-: Governs the location, orientation and stretching of the node. You can use the *Move*, *Rotate* and *Scale* tools to change these values. The values can be animated from script.
+: 节点位移. 可以使用 *移动*, *旋转* 和 *缩放* 工具自由修改. 也可以用脚本动画形式控制这些值.
 
-Size (box, text and pie nodes)
-: The size of the node is automatic by default but by setting the *Size Mode* to `Manual` you can alter the value. The size defines the bounds of the node and is used when doing input picking. This value can be animated from script.
+Size (box, text 和 pie 节点)
+: 默认尺寸设置为自动, 如果需要手动设定尺寸可以设置 *Size Mode* 为 `Manual`. 节点尺寸决定了节点接收输入操作的范围. 此值也可使用脚本动画进行控制.
 
-Size Mode (box and pie nodes)
-: If set to `Automatic` the editor will set a size for the node. If set to `Manual` you can set the size yourself.
+Size Mode (box 和 pie 节点)
+: 如果设为 `Automatic` 则自动计算并设置节点尺寸. 如果设为 `Manual` 则需手动设置节点尺寸.
 
-Text (text nodes)
-: The text to display on the node.
+Text (text 节点)
+: 节点上显示的文字.
 
-Line Break (text nodes)
-: Set for text to wrap according to the width of the node.
+Line Break (text 节点)
+: 文字基于节点宽度换行.
 
-Font (text nodes)
-: The font to use when rendering the text.
+Font (text 节点)
+: 文字字体.
 
-Texture (box and pie nodes)
-: The texture to draw on the node. This is a reference to an image or animation in an atlas or tile source.
+Texture (box 和 pie 节点)
+: 节点上显示的纹理. 可以使用图集和瓷砖图源的图片或动画.
 
-Slice 9 (box nodes)
-: Set to preserve the pixel size of the node's texture around the edges when the node is resized. See the [Box node documentation](/manuals/gui-box) for details.
+Slice 9 (box 节点)
+: 缩放九宫格. 详情请见 [box 节点教程](/manuals/gui-box).
 
-Inner Radius (pie nodes)
-: The inner radius of the node, expressed along the X axis. See the [Pie node documentation](/manuals/gui-pie) for details.
+Inner Radius (pie 节点)
+: 节点内半径, 延 X 轴. 详情请见 [pie 节点教程](/manuals/gui-pie).
 
-Outer Bounds (pie nodes)
-: Controls the behavior of the outer bounds. See the [Pie node documentation](/manuals/gui-pie) for details.
+Outer Bounds (pie 节点)
+: 节点外轮廓. 详情请见 [pie 节点教程](/manuals/gui-pie).
 
-Perimeter Vertices (pie nodes)
-: The number of segments that will be used to build the shape. See the [Pie node documentation](/manuals/gui-pie) for details.
+Perimeter Vertices (pie 节点)
+: 图形的分段数, 就是360度一圈需要的顶点数. 详情请见 [Pie 节点教程](/manuals/gui-pie)
 
-Pie Fill Angle (pie nodes)
-: How much of the pie should be filled. See the [Pie node documentation](/manuals/gui-pie) for details.
+Pie Fill Angle (pie 节点)
+: 饼状图的填充. 详情请见 [Pie 节点教程](/manuals/gui-pie)
 
-Template (template nodes)
-: The GUI scene file to use as template for the node. See the [Template node documentation](/manuals/gui-template) for details.
+Template (template 节点)
+: 节点模板界面文件. 详情请见 [Template 节点教程](/manuals/gui-template)
 
-Spine Scene (spine nodes)
-: The Spine Scene to use for this node. See the [Spine node documentation](/manuals/gui-spine) for details.
+Spine Scene (spine 节点)
+: 节点上显示的spine scene. 详情请见 [Spine 节点教程](/manuals/gui-spine)
 
-Default Animation (spine nodes)
-: The animation to automatically play on this node. See the [Spine node documentation](/manuals/gui-spine) for details.
+Default Animation (spine 节点)
+: 节点上自动播放的spine动画. 详情请见 [Spine 节点教程](/manuals/gui-spine)
 
-Skin (spine nodes)
-: The skin to use for the node. See the [Spine node documentation](/manuals/gui-spine) for details.
+Skin (spine 节点)
+: 节点上使用的spine皮肤. 详情请见 [Spine 节点教程](/manuals/gui-spine)
 
-ParticleFX (particlefx nodes)
-: The particle effect to use on this node. See the [ParticleFX node documentation](/manuals/gui-particlefx) for details.
+ParticleFX (particlefx 节点)
+: 节点上显示的粒子特效. 详情请见 [ParticleFX 节点教程](/manuals/gui-particlefx)
 
 Color
-: The color of the node. It the node is textured, the color tints the texture. The color can be animated from script.
+: 节点颜色. 如果用纹理填充, 则对纹理进行染色. 颜色可由脚本动画控制.
 
 Alpha
-: The translucency of the node. The alpha value can be animated from script.
+: 节点不透明度. 不透明度可由脚本动画控制.
 
 Inherit Alpha
-: Setting this checkbox makes a node inherit the alpha value of the parent node. The node's alpha value is then multiplied with the parent's alpha value.
+: 继承父节点不透明度. 最终结果是父节点与此节点不透明度的叠加.
 
-Leading (text nodes)
-: A scaling number for the line spacing. A value of `0` gives no line spacing. `1` (the default) is normal line spacing.
+Leading (text 节点)
+: 每行开头空白. `0` 无空白. 默认值为 `1`.
 
-Tracking (text nodes)
-: A scaling number for the letter spacing. Defaults to 0.
+Tracking (text 节点)
+: 字符间距缩放值. 默认值为 0.
 
 Layer
-: Assigning a layer to the node overrides the normal draw order and instead follows the layer order. See below for details.
+: 把此节点分配给层. 详情请见下文.
 
 Blend mode
-: Controls how the graphics of the node is blended with background graphics:
-  - `Alpha` alpha blends the pixel values of the node with the background. This corresponds to "Normal" blend mode in graphics software.
-  - `Add` adds the pixel values of the node with the background. This corresponds to "Linear dodge" in some graphics software.
-  - `Multiply` multiplies the pixel values of the node with the background.
+: 混合模式控制其与下层颜色混合后的结果:
+  - `Alpha` 覆盖下层颜色. 有的软件将其称作 "普通" 混合模式.
+  - `Add` 叠加下层颜色. 有的软件将其称作 "增强" 混合模式.
+  - `Multiply` 与下层颜色相乘.
 
 Pivot
-: Sets the pivot point for the node. This can be seen as the "center point" of the node. Any rotation, scaling or size change will happen around this point.
+: 节点的轴点. 可以看作是节点 "中心点". 各种旋转缩放等操作都基于这个轴点.
 
-  Possible values are `Center`, `North`, `South`, `East`, `West`, `North West`, `North East`, `South West` or `South East`.
+  可选值有 `Center`, `North`, `South`, `East`, `West`, `North West`, `North East`, `South West` 和 `South East`.
 
   ![pivot point](images/gui/pivot.png){srcset="images/gui/[email protected] 2x"}
 
-  If you change the pivot of a node, the node will be moved so that the new pivot will be at the node's position. Text nodes are aligned so that `Center` sets the text center-aligned, `West` sets the text left-aligned and `East` sets the text right-aligned.
+  如果修改了节点的轴点, 节点会适当移动以保证坐标位置不变. 对于文本节点来说 `Center` 意味着文字居中对齐, `West` 意味着文字左对齐, `East` 意味着文字右对齐.
 
 X Anchor, Y Anchor
-: Anchoring controls how the node's vertical and horizontal position is altered when the scene boundaries, or the parent node's boundaries are stretched to fit the physical screen size.
+: 锚点控制着当窗体或者父节点拉伸时当前节点位置如何处理.
 
   ![Anchor unadjusted](images/gui/anchoring_unadjusted.png){srcset="images/gui/[email protected] 2x"}
 
-  The following anchoring modes are available:
+  可选值有:
 
-  - `None` (for both *X Anchor* and *Y Anchor*) keeps the node's position from the center of the parent node or scene, relative it's *adjusted* size.
-  - `Left` or `Right` (*X Anchor*) scales the horizontal position of the node so it keeps the position from the left and right edges of the parent node or scene at the same percentage.
-  - `Top` or `Bottom` (*Y Anchor*) scales the vertical position of the node so it keeps the position from the top and bottom edges of the parent node or scene at the same percentage.
+  - `None` (*X轴* 和 *Y轴*) 相对于窗体或者父节点的中心, 保持自身位置.
+  - `Left` 或 `Right` (*X轴*) 缩放水平方向位置以便保持其相对于窗体或者父节点宽度方向上的百分比位置不变.
+  - `Top` 或 `Bottom` (*Y轴*) 缩放垂直方向位置以便保持其相对于窗体或者父节点高度方向上的百分比位置不变.
 
   ![Anchoring](images/gui/anchoring.png){srcset="images/gui/[email protected] 2x"}
 
 Adjust Mode
-: Sets the adjust mode for the node. The adjust mode setting controls what happens to a node when the scene boundaries, or the parent node's boundaries, are adjusted to fit the physical screen size.
+: 节点调整模式. 调整模式控制着当窗体或者父节点拉伸时当前节点尺寸如何处理.
 
-  A node created in a scene where the logical resolution is a typical landscape resolution:
+  这里有一个节点放置在逻辑分辨率为横屏的场景中:
 
   ![Unadjusted](images/gui/unadjusted.png){srcset="images/gui/[email protected] 2x"}
 
-  Fitting the scene to a portrait screen cause the scene to be stretched. Each node's bounding box is similarly stretched. However, by setting the adjust mode, the aspect ratio of the node's content can be kept intact. The following modes are available:
+  当场景需要填充竖屏时. 每个节点都会被拉伸. 但是如果使用了适当的调整模式, 节点内容的长宽比可以保持不变. 可选值有:
 
-  - `Fit` scales the node content so that it is equal to the stretched bounding box width or height, whichever is smallest. In other words, the content will fit inside the stretched node bounding box.
-  - `Zoom` scales the node content so that it is equal to the stretched bounding box width or height, whichever is largest. In other words, the content will fully cover the stretched node bounding box.
-  - `Stretch` stretches the node content so it fills the stretched node bounding box.
+  - `Fit` 缩放节点内容,使其等于拉伸的边界框宽度或高度, 以数值最小者为准. 换句话说, 内容将拉伸到父级的边界.
+  - `Zoom` 缩放节点内容,使其等于拉伸的边界框宽度或高度, 以数值最大者为准. 换句话说, 内容将超越过父级的边界.
+  - `Stretch` 拉伸节点内容, 使其填充父级的边界框.
 
   ![Adjust modes](images/gui/adjusted.png){srcset="images/gui/[email protected] 2x"}
 
-  If the GUI scene property *Adjust Reference* is set to `Disabled`, this setting will be ignored.
+  如果场景的 *Adjust Reference* 设置为 `Disabled` 的话, 此设置被忽略.
 
-Clipping Mode (box, pie and spine nodes)
-: Sets the clipping mode on the node:
+Clipping Mode (box, pie 和 spine 节点)
+: 剔除模式:
 
-  - `None` renders the node as usual.
-  - `Stencil` makes the node boundaries define a stencil mask that is used to clip the node's child nodes.
+  - `None` 正常渲染.
+  - `Stencil` 以当前节点边框作为子节点蒙版.
 
-  See the [GUI clipping manual](/manuals/gui-clipping) for details.
+  详情请见 [GUI 蒙版教程](/manuals/gui-clipping)
 
-Clipping Visible (box, pie and spine nodes)
-: Set to render the node's content in the stencil area. See the [GUI clipping manual](/manuals/gui-clipping) for details.
+Clipping Visible (box, pie 和 spine 节点)
+: 蒙版可见. 详情请见 [GUI clipping manual](/manuals/gui-clipping)
 
-Clipping Inverted (box, pie and spine nodes)
-: Invert the stencil mask. See the [GUI clipping manual](/manuals/gui-clipping) for details.
+Clipping Inverted (box, pie 和 spine 节点)
+: 反转蒙版. 详情请见 [GUI clipping manual](/manuals/gui-clipping)
 
 
-## Pivot, Anchors and Adjust Mode
+## 原点, 锚点和调整模式
 
-The combination of Pivot, Anchors and Adjust Mode properties allows for a very flexible design of GUIs but it can be somewhat hard to understand how it all works without looking at a concrete example. Let's take this GUI mockup created for a 640x1136 screen as an example:
+轴点, 锚点和调整模式互相配合可以给设计者很大的发挥空间. 但是但凭想象很难搞清楚它们对应的具体功能. 这里列举了一个具体的例子, 屏幕分辨率 640x1136 的界面:
 
 ![](images/gui/adjustmode_example_original.png)
 
-The UI is created with X and Y Anchors set to None and the Adjust Mode for each node is left at the default value of Fit. The Pivot point for the top panel is North, the pivot for the bottom panel is South and the pivot point for the bars in the top panel are set to West. The rest of the nodes have pivot points set to Center. If we resize the window to make it wider this is what happens:
+ 界面的 X 和 Y 锚点为 None 调整模式为 left. 上面板轴点为 North, 下面板轴点为 South 上面版里的进度条轴点为 West. 其他节点轴点都为 Center. 如果把窗体拉宽, 看看会发生什么:
 
 ![](images/gui/adjustmode_example_resized.png)
 
-Now, what if we want the top and bottom bars to always be as wide as the screen? We can change the Adjust Mode for the grey background panels at the top and bottom to Stretch:
+如果我们希望上下面板保持屏幕宽度要怎么做? 可以把两个面板的调整模式设置为 Stretch:
 
 ![](images/gui/adjustmode_example_resized_stretch.png)
 
-This is better. The grey background panels will now always stretch to the width of the window, but the bars in the top panel as well as the two boxes at the bottom aren't positioned properly. If we want to keep the bars at the top positioned to the left we need to change the X Anchor from None to Left:
+出不多了. 上下两个面板会拉伸并一直保持屏幕宽度大小, 但是进度条和下面版的内容位置不太对. 要是想让进度条于上面版左对齐, 修改 X 锚点为 Left:
 
 ![](images/gui/adjustmode_example_top_anchor_left.png)
 
-That is exactly as we want it for the top panel. The bars in the top panel already had their Pivot points set to West which means that they will position themselves nicely with the left/west edge of the bars (Pivot) anchored to the left edge of the parent panel (X Anchor).
+上面版完美了. 进度条本身轴点是 West 也就是说让它们的左端 (轴点) 与父级面板左边缘 (X 锚点) 对齐.
 
-Now, if we set the X Anchor to Left for the box on the left and the X Anchor to Right for the box on the right we get the following result:
+然后再把下面版左边方块的 X 锚点设置为 Left, 右边方块的 X 锚点设置为 Right, 就会变成这样:
 
 ![](images/gui/adjustmode_example_bottom_anchor_left_right.png)
 
-This is not quite the expected result. The two boxes should stay as close to the left and right edges as the two bars did in the top panel. The reason for this is that the Pivot point is wrong:
+结果还是不太对. 我们想让两个方块分别呆在下面版的左右两端. 但是轴点搞错了:
 
 ![](images/gui/adjustmode_example_bottom_pivot_center.png)
 
-Both boxes have a Pivot point set to Center. What this means is that when the screen becomes wider the center point (the pivot point) of the boxes will stay at the same relative distance from the edges. In the case of the left box it was 17% from the left edge with the original 640x1136 window:
+两个方块的轴点都是 Center. 也就是说当窗体变宽时方块的位置 (轴点) 处于相对于边缘的固定位置上. 本例中左边方块在 640x1136 分辨率窗口中大约位于离左边界 17% 的地方:
 
 ![](images/gui/adjustmode_example_original_ratio.png)
 
-When the screen is resized the center point of the left box remains at the same distance of 17% from the left edge:
+屏幕缩放时它保持这个 17% 的位置:
 
 ![](images/gui/adjustmode_example_resized_stretch_ratio.png)
 
-If we change the Pivot point from Center to West for the box on the left and to East for the box on the right and reposition the boxes we get the result we're after even when the screen is resized:
+如果把左边方块轴点设为 West, 右边方块设为 East 结果就是我们想要的样子了:
 
 ![](images/gui/adjustmode_example_bottom_pivot_west_east.png)
 
 
-## Draw order
+## 绘制顺序
 
-All nodes are rendered in the order they are listed under the "Nodes" folder. The node at the top of the list is drawn first and will thus appear behind every other node. The last node in the list is drawn last, meaning it will appear in front of all other nodes. Altering the Z-value on a node does not control its draw order; however, if you set the Z-value outside of your render script's render range the node will no longer be rendered to screen. You can override the index ordering of nodes with layers (see below).
+节点基于 "Nodes" 文件夹的排序进行绘制. 最高处节点最先绘制, 也就是会被放置于其他节点的后面. 最下面的节点最后绘制, 即它会位于其他节点前面. 至于节点 Z 值并不影响绘制顺序; 但是记得如果Z值超过了渲染脚本的渲染范围就不被渲染了. 可以使用层来覆盖这个默认的绘制顺序 (见下文).
 
 ![Draw order](images/gui/draw_order.png){srcset="images/gui/[email protected] 2x"}
 
-Select a node and press <kbd>Alt + Up/Down</kbd> to move a node up or down and change its index order.
+选中节点按 <kbd>Alt + Up/Down</kbd> 移动其在列表中的排序.
 
-The draw order can be changed in script:
+排序也可使用脚本控制:
 
 ```lua
 local bean_node = gui.get_node("bean")
@@ -302,50 +302,50 @@ if gui.get_index(shield_node) < gui.get_index(bean_node) then
 end
 ```
 
-## Parent-child hierarchies
+## 父子结构
 
-A node is made the child of another node by dragging it onto the node that you wish to be the child's parent. A node with a parent inherits the transform (position, rotation and scale) applied to the parent and relative to the parent pivot.
+把节点拖放到另一节点上就组成了一个父子结构. 子节点基于父节点轴点继承父节点的位移 (位置, 旋转和缩放).
 
 ![Parent child](images/gui/parent_child.png){srcset="images/gui/[email protected] 2x"}
 
-Parents are drawn before their children. Use layers to change the draw order of parent and child nodes and to optimize the rendering of nodes (see below).
+父节点先于子节点进行绘制. 使用层可以改变这个顺序还可以优化性能 (见下文).
 
 
-## Layers and draw calls
+## 层与 drawcall
 
-Layers give fine grained control over how nodes are drawn and can be used to reduce the number of draw calls the engine must create to draw a GUI scene. When the engine is about to draw the nodes of a GUI scene, it groups the nodes into draw call batches based on the following conditions:
+Layers 可以方便控制节点绘制顺序以及减少drawcall. 引擎绘制界面前, 会根据以下规则合批渲染:
 
-- The nodes must use the same type.
-- The nodes must use the same atlas or tile source.
-- The nodes must be rendered with the same blend mode.
-- They must use same font.
+- 节点类型相同.
+- 节点纹理源自同一张图集或瓷砖图源.
+- 节点的渲染模式相同.
+- 节点使用的字体相同.
 
-If a node differs from the previous one on any of these points, it will break the batch and create another draw call. Clipping nodes always break the batch and each stencil scope also breaks the batch.
+如果有一条不符合, 就会破坏合批产生另一个drawcall. 蒙版和被蒙节点必然会破坏合批产生drawcall.
 
-The ability to arrange nodes in hierarchies makes it easy to group nodes into manageable units. But hierarchies can effectively break batch rendering if you mix different node types:
+树形结构对于节点管理非常方便. 但是不同类型节点的混合一定会打破合批渲染:
 
 ![Breaking batch hierarchy](images/gui/break_batch.png){srcset="images/gui/[email protected] 2x"}
 
-When the rendering pipeline walks through the list of nodes, it is forced to set up a separate batch for each separate node because the types are different. All in all these three buttons will require six draw calls.
+渲染管线被迫为不同类型的节点建立不同的渲染批次. 这三个按钮就会产生6次drawcall.
 
-By assigning layers to the nodes, they can be ordered differently, allowing the render pipeline to group the nodes together in fewer draw calls. Start by adding the layers you need to the scene. <kbd>Right click</kbd> the "Layers" folder icon in the *Outline* and select <kbd>Add ▸ Layer</kbd>. Mark the new layer and assign it a *Name* property in the *Properties* view.
+要是使用层, 就可以重塑节点的绘制顺序, 渲染管线就能更好地进行合批减少drawcall. 第一步新建层. 在 *Outline* 的 "Layers" 文件夹上 <kbd>右键点击</kbd> 然后选择 <kbd>Add ▸ Layer</kbd>. 在 *Properties* 视图中填充 *Name* 属性给层命名.
 
 ![Layers](images/gui/layers.png){srcset="images/gui/[email protected] 2x"}
 
-Then set the *Layer* property on each node to the corresponding layer. The layer drawing order takes precedence over the regular indexed node order, so setting the button graphics box-nodes to "graphics" and the button text nodes to "text" will result in the following draw order:
+现在给每个节点的 *Layer* 属性都分配适当的层. 层的绘制顺序优先级高于默认情况, 所以把按钮底图都分配给 "graphics" 层, 文本节点都分配给 "text" 层, 那么界面绘制的顺序就是这样的:
 
-* First all nodes in the "graphics" layer, from the top:
+* 先绘制 "graphics" 层里的节点:
 
   1. "button-1"
   2. "button-2"
   3. "button-3"
 
-* Then all nodes in the "text" layer, from the top:
+* 再绘制 "text" 层里的节点:
 
   4. "button-text-1"
   5. "button-text-2"
   6. "button-text-3"
 
-The nodes can now be batched into two draw calls, instead of six. A major performance win!
+这样一来合批就成形了, 不再需要那么多drawcall了!
 
-Note that a child node with unset layer will implicitly inherit the layer setting of its parent node. Not setting a layer on a node implicitly adds it to the "null" layer, which is drawn before any other layer.
+注意如果子节点没有设置分配层默认继承分配父节点所在的层. 没有设置分配层的节点会被归为 "null" 层, 这个层最先被绘制.

+ 3 - 3
docs/zh/manuals/html5.md

@@ -42,7 +42,7 @@ Python 3:
 如果在控制台见到 "wasm streaming compile failed: TypeError: Failed to execute ‘compile’ on ‘WebAssembly’: Incorrect response MIME type. Expected ‘application/wasm’." 错误, 请确保你的服务器设置了 `application/wasm` MIME 类型对应 .wasm 文件.
 :::
 
-## 打包 HTML5 游戏
+## HTML5游戏打包
 
 Defold 打包 HTML5 游戏很简单, 跟其他平台一样: 从菜单栏选择 <kbd>Project ▸ Bundle...​ ▸ HTML5 Application...</kbd>:
 
@@ -60,7 +60,7 @@ Defold 打包 HTML5 游戏很简单, 跟其他平台一样: 从菜单栏选择 <
 * Chrome
   * Slow debug builds - 为了在 HTML5 平台更好地调试我们开启了校验所有 WebGL 图像调用来检测错误. 但是这样做在 Chrome 上会运行缓慢. 可以把 *game.project* 里的 *Engine Arguments* 部分设置为 `–-verify-graphics-calls=false` 来关闭图像调用校验.
 
-## 自定义 HTML5 打包
+## 自定义HTML5打包
 
 针对 HTML5 版本的游戏, Defold 提供了一个默认模板网页. 其中包含的样式和脚本代码决定了游戏的显示方式.
 
@@ -68,7 +68,7 @@ Defold 打包 HTML5 游戏很简单, 跟其他平台一样: 从菜单栏选择 <
 
 ![HTML5 Section](images/html5/html5_section.png)
 
-关于每个选项详情请见 [形目设置教程](/manuals/project-settings/#html5).
+关于每个选项详情请见 [形目设置教程](/manuals/project-settings/#HTML5).
 
 ::: 注意
 `builtins` 文件夹下的默认 html/css 模板文件是不能直接修改的. 要先从 `builtins` 里把文件拷贝出来然后再在 `game.project` 文件里指明要使用的文件的位置.

+ 1 - 1
docs/zh/manuals/importing-graphics.md

@@ -35,7 +35,7 @@ Defold 支持 PNG 和 JPEG 图片格式. 其他格式要先转换成支持格式
 ![bitmap font](images/icons/font.png){.icon} Bitmap Font
 : 位图字体是 PNG 图片格式的文字表. 这种字体比起 TrueType 或者 OpenType 字体文件并没有性能优势, 但是由于是图片, 颜色阴影等效果可以随意加入.
 
-关于字体资源详情请见 [字体教程](/manuals/font/#bitmap-bmfonts).
+关于字体资源详情请见 [字体教程](/manuals/font/#位图 BMFont).
 
   ![BMfont](images/font/bm_font.png){srcset="images/font/[email protected] 2x"}
 

+ 102 - 102
docs/zh/manuals/input.md

@@ -5,125 +5,125 @@ brief: 本教程介绍了输入系统如何工作, 如何捕获输入行为和
 
 # 输入
 
-输入由引擎捕获并转化为输入行为传送到获取了输入焦点并且实现了 `on_input()` 函数的游戏对象脚本组件中去. This manual explains how you set up bindings to capture input and how you create code that responds to it.
+输入由引擎捕获并转化为输入行为传送到获取了输入焦点并且实现了 `on_input()` 函数的游戏对象脚本组件中去. 本教程介绍了捕获输入绑定行为的方法以及如何用代码对输入做出响应.
 
-The input system uses a set of simple and powerful concepts, allowing you to manage input as you see fit for your game.
+输入系统包含一些概念, 用以让开发者直观地处理游戏逻辑.
 
 ![Input bindings](images/input/overview.png){srcset="images/input/[email protected] 2x"}
 
 Devices
-: Input devices that are either part of, or plugged into, your computer or mobile device provide raw system level input to the Defold runtime. The following device types are supported:
+: 不管是插上的, 连上的, 有线无线的, 操作系统级别的底层能够进行输入的设备. Defold 支持以下设备:
 
-  1. Keyboard (single key as well as text input)
-  2. Mouse (position, button clicks and mouse wheel actions)
-  3. Single and multi-touch (on iOS, Android devices and HTML5 on mobile)
-  4. Gamepads (as supported through the operating system and mapped in the [gamepads](#gamepads-settings-file) file)
+  1. 键盘 (包括按键输入和文本输入)
+  2. 鼠标 (位置, 按键, 滚轮输入)
+  3. 单点/多点触摸屏 (iOS, Android 设备和 HTML5 手机端)
+  4. 游戏手柄 (操作系统负责将其输入发送给游戏然后映射给脚本. 详见 [游戏手柄配置文件](#gamepads-settings-file))
 
 Input bindings
-: Before input is sent to a script the raw input from the device is translated into meaningful *actions* via the input bindings table.
+: 发送给脚本之前设备原始输入信号要通过映射表转化为有意义的 *动作* 指令.
 
 Actions
-: Actions are identified by the (hashed) names that you list in the input bindings file. Each action also contain relevant data about the input: if a button is pressed or released, the coordinates of the mouse and touch etc.
+: 动作是列在输入绑定文件里的 (哈希过的) 名字. 每种动作还包括其相关数据: 比如按钮是被按下还是抬起, 鼠标或触摸屏幕坐标等等.
 
 Input listeners
-: Any script component or GUI script can receive input actions by *acquiring input focus*. Several listeners can be active at the same time.
+: 脚本可以得到 *获取了输入焦点的* 组件的输入消息. 一个输入信息可以同时激活多个输入监听器.
 
 Input stack
-: The list of input listeners with the first acquirer of focus at the bottom of the stack and the last acquirer at the top.
+: 首个获取输入焦点的组件位于最下端, 最后一个获取输入焦点的组件位于最上端的输入监听器堆栈.
 
 Consuming input
-: A script may choose to consume the input it received, preventing listeners further down the stack to receive it.
+: 脚本消耗了输入信息, 不再让输入栈的深层监听器得到这个信息.
 
-## Setting up input bindings
+## 输入绑定设置
 
-The input bindings is a project wide table that allows you to specify how device input should translate into named *actions* before they are dispatched to your script components and GUI scripts. You can create a new input binding file, <kbd>right click</kbd> a location in the *Assets* view and select <kbd>New... ▸ Input Binding</kbd>. To make the engine use the new file, change the *Game Binding* entry in "game.project".
+输入绑定是整个项目通用的, 记录如何把设备输入映射为带名字的 *动作* 以方便脚本使用的列表. 新建输入绑定文件, 在 *Assets* 视图中 <kbd>右键点击</kbd> 选择 <kbd>New... ▸ Input Binding</kbd>. 然后修改 "game.project" 里 *Game Binding* 项对输入绑定文件的引用.
 
 ![Input binding setting](images/input/setting.png){srcset="images/input/[email protected] 2x"}
 
-A default input binding file is automatically created with all new project templates so there is usually no need to create a new binding file. The default file is called "game.input_binding" and can be found in the "input" folder in the project root. <kbd>Double click</kbd> the file to open it in the editor:
+每个新建项目都会自动生成默认输入绑定文件. 默认叫做 "game.input_binding", 位于项目根目录下 "input" 文件夹内. <kbd>双击</kbd> 即可在编辑器中打开此文件:
 
 ![Input set bindings](images/input/input_binding.png){srcset="images/input/[email protected] 2x"}
 
-To create a new binding, click the <kbd>+</kbd> button at the bottom of the relevant trigger type section. Each entry has two fields:
+点击相关触发类型底部的 <kbd>+</kbd> 按钮, 即可新建一个绑定项. 每一项有两个部分:
 
 *Input*
-: The raw input to listen for, selected from a scroll list of available inputs.
+: 需要监听的底层输入信号, 从滚动列表里选择.
 
 *Action*
-: The action name given to input actions when they are created and dispatched to your scripts. The same action name can be assigned to multiple inputs. For instance, you can bind the <kbd>Space</kbd> key and the gamepad "A" button to the action `jump`. Note that there is a known bug where touch inputs unfortunately cannot have the same action names as other inputs.
+: 输入对应的用于发送给脚本的动作名. 一个动作可以对应多个输入. 例如, 可以设置按下 <kbd>空格</kbd> 键和游戏手柄 "A" 按钮都是 `jump` 动作. 可是触屏输入的动作名必须是唯一值.
 
-## Trigger types
+## 触发器类型
 
-There are five device specific types of triggers that you can create
+触发器有五种类型:
 
 Key Triggers
-: Single key keyboard input. Each key is mapped separately into a corresponding action. Key triggers are used to tie specific buttons to specific functions, like character movement with the arrow or WASD keys. If you need to read arbitrary keyboard input, use text triggers (see below).
+: 键盘单键输入. 每个键分别映射为动作. 一个键一个功能, 比如箭头键或者 WASD 键对应上左下右. 如果需要获得输入字符, 要使用 text triggers (见下文).
 
 Mouse Triggers
-: Input from mouse buttons and scroll wheels. Mouse movement is handled separately. Mouse movement events are not received unless at least one mouse trigger is set up in your input bindings.
+: 鼠标按键或者滚轮输入. 鼠标移动输入事件不在这里设定. 但是如果没设定鼠标触发器, 也不会捕获鼠标移动事件.
 
-  - Mouse button inputs `MOUSE_BUTTON_LEFT`, `MOUSE_BUTTON_RIGHT` and `MOUSE_BUTTON_MIDDLE` are equivalent to `MOUSE_BUTTON_1`, `MOUSE_BUTTON_2` and `MOUSE_BUTTON_3`.
+  - 鼠标按键输入 `MOUSE_BUTTON_LEFT`, `MOUSE_BUTTON_RIGHT` 和 `MOUSE_BUTTON_MIDDLE` 等同于 `MOUSE_BUTTON_1`, `MOUSE_BUTTON_2` 和 `MOUSE_BUTTON_3`.
 
-  - **`MOUSE_BUTTON_LEFT` (or `MOUSE_BUTTON_1`) input actions are sent for single touch inputs as well**.
+  - **单点触摸也会触发 `MOUSE_BUTTON_LEFT` (或 `MOUSE_BUTTON_1`) 事件**.
 
-  - Mouse wheel inputs detect scroll actions. The field `action.value` is `1` if the wheel is scrolled and `0` otherwise. (Scroll actions are dealt with as they were button presses. Defold does not currently support fine grained scroll input on touch pads.)
+  - 鼠标滚轮转动输入. 如果 `action.value` 为 `1` 代表转动, 为 `0` 代表不转动. (滚轮转动被当作按钮按下处理. Defold 目前不支持触摸板上的滚轮输入.)
 
-  - Mouse movement are not bound in the input bindings but `action_id` is set to `nil` and the `action` table is populated with the location and delta movement of the mouse position.
+  - 鼠标移动不在此做设定, 但是鼠标移动时会自动发出事件, 其中 `action_id` 为 `nil` 并且 `action` 表保存了鼠标位置与移动距离.
 
 Gamepad Triggers
-: Gamepad triggers allow you to bind standard gamepad input to game functions. Defold supports multiple gamepads through the host operating system, actions set the `gamepad` field of the action table to the gamepad number the input originated from:
+: 游戏手柄触发器绑定标准手柄输入到游戏功能的映射. Defold 通过操作系统支持多种游戏手柄, 事件里 `gamepad` 项对应手柄输入来源:
 
   ```lua
   if action_id == hash("gamepad_start") then
     if action.gamepad == 0 then
-      -- gamepad 0 wants to join the game
+      -- gamepad 0 申请加入游戏
     end
   end
   ```
 
-  Gamepad input and offers bindings for:
+  游戏手柄可以绑定:
 
-  - Left and right sticks (direction and clicks)
-  - Left and right digital pads. Right pad usually translates to the "A", "B", "X" and "Y" buttons on the Xbox controller and "square", "circle", "triangle" and "cross" buttons on the Playstation controller.
-  - Left and right triggers
-  - Left and right shoulder buttons
-  - Start, Back and Guide buttons
+  - 左右摇杆 (方向和按下)
+  - 手柄按钮. 通常右手柄 Xbox 为 "A", "B", "X" 和 "Y", Playstation 为 "方块", "圆圈", "三角" 和 "十叉".
+  - 方向按钮.
+  - 左右肩按钮.
+  - 开始, 后退, 暂停按钮
 
-  On Windows, only XBox 360 controllers are currently supported. To hook up your 360 controller to your Windows machine, make sure it is setup correctly. See http://www.wikihow.com/Use-Your-Xbox-360-Controller-for-Windows
+  在 Windows 上, 只支持 XBox 360 兼容手柄. 安装方法请见 http://www.wikihow.com/Use-Your-Xbox-360-Controller-for-Windows
 
-  Gamepad input setup uses a separate mapping file for each hardware gamepad type. See below for more information.
+  每种手柄分别对应一份映射文件. 详情请见下文.
   
-  Gamepad input bindings also provides two separate bindings named `Connected` and `Disconnected` to detect when a gamepad is connected (even those connected from the start) or disconnected.
+  游戏手柄还有 `Connected` 和 `Disconnected` 两种事件用以通知手柄连接和断开.
 
 Touch Triggers
-: Single-touch type triggers are available on iOS and Android devices. Single-touch type triggers are not set up from the Touch Triggers section of the input bindings. Instead **single-touch triggers are automatically set up when you have mouse button input set up for `MOUSE_BUTTON_LEFT` or `MOUSE_BUTTON_1`**.
+: iOS 和 Android 设备支持单点触摸. 单点触摸不用在触摸映射部分进行设置. 而在 **鼠标映射设置 `MOUSE_BUTTON_LEFT` 或 `MOUSE_BUTTON_1`** 之后自动触发.
 
-: Multi-touch type triggers are available on iOS and Android devices in native applications and HTML5 bundles. They populate a table in the action table called `touch`. The elements in the table are integer-indexed with numbers `1`--`N`where `N` is the number of touch points. Each element of the table contains fields with input data:
+: iOS 和 Android 设备支持 APP 和 HTML5 应用的多点触摸. 触发时 `touch` 表即是记录触摸点的数组. 其中数组键 `1`--`N` 的 `N` 是触摸点的排号. 对应的值为触摸点数据:
 
   ```lua
-  -- Spawn at each touch point
+  -- 捕获到接触事件时触发
   for i, touchdata in ipairs(action.touch) do
     local pos = vmath.vector3(touchdata.x, touchdata.y, 0)
     factory.create("#factory", pos)
   end
   ```
 
-::: important
-Multi-touch must not be assigned the same action as the mouse button input for `MOUSE_BUTTON_LEFT` or `MOUSE_BUTTON_1`. Assigning the same action will effectively override single-touch and prevent you from receiving any single-touch events.
+::: 注意
+多点触摸动作名不能与 `MOUSE_BUTTON_LEFT` 或 `MOUSE_BUTTON_1` 的动作名重名. 否则的话将导致事件覆盖, 就监听不到单点触摸事件了.
 :::
 
-::: sidenote
-The [Defold-Input asset](https://defold.com/assets/defoldinput/) can be used to easily set up virtual on-screen controls such as buttons and analog sticks with support for multi touch.
+::: 注意
+公共资源 [Defold 输入手柄](https://defold.com/assets/defoldinput/) 可以用来在多点触摸屏上模拟手柄输入.
 :::
 
 Text Triggers
-: Text triggers are used to read arbitrary text input. There are two types of text triggers:
+: 文本触发器用来读取输入的文字. 分为以下两种:
 
-  - `text` captures normal text input. It sets the `text` field of the action table to a string containing the typed character. The action is only fired at the press of the button, no `release` or `repeated` action is sent.
+  - `text` 捕获一般字符输入. 事件 `text` 项保存了输入的字符. 动作由按下按钮时触发, 不存在 `release` 和 `repeated` 事件.
 
     ```lua
     if action_id == hash("text") then
-      -- Concatenate the typed character to the "user" node...
+      -- 收集输入字符填充 "user" 节点...
       local node = gui.get_node("user")
       local name = gui.get_text(node)
       name = name .. action.text
@@ -131,63 +131,63 @@ Text Triggers
     end
     ```
 
-  - `marked-text` is used primarily for asian keyboards where multiple keypresses can map to single inputs. For example, with the iOS "Japanese-Kana" keyboard, the user can type combinations and the top of the keyboard will display avaliable symbols or sequences of symbols that can be entered.
+  - `marked-text` 一般用于亚洲键盘可把多个按键事件合为一个输入事件. 比如说, iOS 里的 "Japanese-Kana" 键盘, 用户输入多个键时键盘上方就会显示出可供输入的文字或字符串.
 
   ![Input marked text](images/input/marked_text.png){srcset="images/input/[email protected] 2x"}
 
-  - Each keypress generates a separate action and sets the action field `text` to the currently entered sequence of symbols (the "marked text").
-  - When the user selects a symbol or symbol combination, a separate `text` type trigger action is sent (provided that one is set up in the input binding list). The separate action sets the action field `text` to the final sequence of symbols.
+  - 每个键被按下时触发事件, 动作 `text` 为目前已经输入了的字符串 (星号标记文本).
+  - 用户选择了要提交的文字时, 一个 `text` 类型动作被触发 (证明当前触发器配置正确). 而这个动作的 `text` 项保存了用户最终提交的文字.
 
-## Input focus
+## 输入焦点
 
-To listen to input actions in a script component or GUI script, the message `acquire_input_focus` should be sent to the game object holding the component:
+脚本要想获得输入消息, 就要把 `acquire_input_focus` 消息发给其所在的游戏对象:
 
 ```lua
--- tell the current game object (".") to acquire input focus
+-- 告诉当前游戏对象 (".") 要接收输入消息了
 msg.post(".", "acquire_input_focus")
 ```
 
-This message instructs the engine to add input capable components (script components, GUI components and collection proxies) in the game objects to the *input stack*. The game object components are put on top of the input stack; the component that is added last will be top of the stack. Note that if the game object contains more than one input capable component, all components will be added to the stack:
+此消息让引擎把可接收输入的游戏对象组件 (脚本, GUI 和集合代理) 压入 *输入栈*. 这些组件位于栈顶; 最后入栈的组件位于栈顶. 注意如果一个游戏对象包含多个输入组件, 所有组件都会入栈:
 
 ![Input stack](images/input/input_stack.png){srcset="images/input/[email protected] 2x"}
 
-Each game world that is dynamically loaded through a collection proxy has its own input stack. For action dispatch to reach the loaded world's input stack, the proxy component must be on the main world's input stack.
+由集合代理加载的每个游戏世界都有自己的输入栈. 被加载的游戏世界获得输入, 前提是主游戏世界输入栈里包含了这个游戏世界的集合代理.
 
-If a game object that has already aquired input focus does so again, its component(s) will be moved to the top of the stack.
+已获得输入焦点的游戏对象再次请求焦点的话, 它上面的所有组件都会被推到输入栈顶.
 
-To stop listening to input actions, send a `release_input_focus` message to the game object. This message will remove any of the game object's components from the input stack:
+要取消动作监听, 发送 `release_input_focus` 消息给游戏对象即可. 这样该游戏对象的所有组件都会从输入栈中移除:
 
 ```lua
--- tell the current game object (".") to release input focus.
+-- 告诉当前游戏对象 (".") 释放输入焦点.
 msg.post(".", "release_input_focus")
 ```
 
-## Input dispatch and on_input()
+## 输入调度和 on_input() 函数
 
-Input actions are dispatched according to the input stack, from the top to the bottom.
+输入事件在输入栈上, 从上到下传递.
 
 ![Action dispatch](images/input/actions.png){srcset="images/input/[email protected] 2x"}
 
-Any component that is on the stack containing an `on_input()` function will have that function called, once for each input action during the frame, with the following arguments:
+每个入栈组件都有 `on_input()` 函数, 一帧中每个输入都调用一次该函数, 连同如下参数:
 
 `self`
-: The current script instance.
+: 当前脚本实例引用.
 
 `action_id`
-: The hashed name of the action, as set up in the input bindings.
+: 动作名哈希串, 与输入映射配置的名称一致.
 
 `action`
-: A table containing the useful data about the action, like the value of the input, its location (absolute and delta positions), whether button input was `pressed` etc. See [on_input()](/ref/go#on_input) for details on the available action fields.
+: 有关动作的表, 包含比如输入值, 位置和移动距离, 按键是不是 `按下` 状态等等. 详情请见 [on_input() 函数](/ref/go#on_input).
 
 ```lua
 function on_input(self, action_id, action)
   if action_id == hash("left") and action.pressed then
-    -- move left
+    -- 左移
     local pos = go.get_position()
     pos.x = pos.x - 100
     go.set_position(pos)
   elseif action_id == hash("right") and action.pressed then
-    -- move right
+    -- 右移
     local pos = go.get_position()
     pos.x = pos.x + 100
     go.set_position(pos)
@@ -195,34 +195,34 @@ function on_input(self, action_id, action)
 end
 ```
 
-Collection proxy components must be on the main world's stack for input to be dispatched to the components on the loaded world's input stack. All components on a loaded world's stack are handled before dispatch continues down the main stack:
+集合代理必须位于主世界输入栈中才能把输入传递到其代理的游戏世界中去. 代理入栈的组件优先与主世界组件获得输入事件触发动作:
 
 ![Action dispatch to proxies](images/input/proxy.png){srcset="images/input/[email protected] 2x"}
 
-It is a common error to forget to send `acquire_input_focus` to the game object holding the collection proxy component. Skipping this step prevents input from reaching any of the components on the loaded world's input stack.
+使用集合代理组件时经常会忘记让其游戏对象 `acquire_input_focus`. 没有这一步其加载的游戏世界将得不到任何输入信息.
 
 ## Consuming input
 
-A component's `on_input()` can actively control whether actions should be passed on further down the stack or not:
+每个 `on_input()` 函数都能决定当前动作是否要阻止其继续传播下去:
 
-- If `on_input()` returns `false`, or a return is omitted (this implies a `nil` return which is a false value in Lua) input actions will be passed on to the next component on the input stack.
-- If `on_input()` returns `true` input is consumed. No component further down the input stack will receive the input. Note that this applies to *all* input stacks. A component on a proxy-loaded world's stack can consume input preventing components on the main stack to receive input:
+- 如果 `on_input()` 返回 `false`, 或者未返回值 (此时默认返回 `nil` 也被看作是false) 输入动作会继续传播.
+- 如果 `on_input()` 返回 `true` 输入就此销毁. 再无组件可以接收到这个消息. 作用于 *全部* 输入栈. 也就是说集合代理加载的组件销毁输入那么主栈的组件就收不到这个输入消息了:
 
 ![consuming input](images/input/consuming.png){srcset="images/input/[email protected] 2x"}
 
-There are many good use cases where input consumption provides a simple and powerful way to shift input between different parts of a game. For example, if you need a pop-up menu that temporarily is the only part of the game that listens to input:
+输入消耗可以使游戏变得灵活, 控制性更强. 例如, 如果需要弹出菜单暂时只有部分界面可以接受点击:
 
 ![consuming input](images/input/game.png){srcset="images/input/[email protected] 2x"}
 
-The pause menu is initially hidden (disabled) and when the player touches the "PAUSE" HUD item, it is enabled:
+菜单开始是隐藏的 (disabled) 玩家点击 "PAUSE" 组件, 菜单被激活:
 
 ```lua
 function on_input(self, action_id, action)
     if action_id == hash("mouse_press") and action.pressed then
-        -- Did the player press PAUSE?
+        -- 玩家点击了 PAUSE?
         local pausenode = gui.get_node("pause")
         if gui.pick_node(pausenode, action.x, action.y) then
-            -- Tell the pause menu to take over.
+            -- 弹出暂停菜单.
             msg.post("pause_menu", "show")
         end
     end
@@ -231,16 +231,16 @@ end
 
 ![pause menu](images/input/game_paused.png){srcset="images/input/[email protected] 2x"}
 
-The pause menu GUI acquires input focus and consumes input, preventing any input other than what's relevant for the pop-up menu:
+此时弹出的暂停菜单获得输入焦点并且消耗输入, 以防止点击穿透:
 
 ```lua
 function on_message(self, message_id, message, sender)
   if message_id == hash("show") then
-    -- Show the pause menu.
+    -- 显示暂停菜单.
     local node = gui.get_node("pause_menu")
     gui.set_enabled(node, true)
 
-    -- Acquire input.
+    -- 获得输入焦点.
     msg.post(".", "acquire_input_focus")
   end
 end
@@ -248,66 +248,66 @@ end
 function on_input(self, action_id, action)
   if action_id == hash("mouse_press") and action.pressed then
 
-    -- do things...
+    -- 这里做其他游戏逻辑...
 
     local resumenode = gui.get_node("resume")
     if gui.pick_node(resumenode, action.x, action.y) then
-        -- Hide the pause menu
+        -- 隐藏暂停菜单
         local node = gui.get_node("pause_menu")
         gui.set_enabled(node, false)
 
-        -- Release input.
+        -- 释放输入焦点.
         msg.post(".", "release_input_focus")
     end
   end
 
-  -- Consume all input. Anything below us on the input stack
-  -- will never see input until we release input focus.
+  -- 消耗掉输入. 输入栈里其他组件
+  -- 不会得到输入, 直到脚本释放输入焦点.
   return true
 end
 ```
 
 
-## Detecting click or tap on objects
+## 拾取检测
 
-Detecting when the user has clicked or tapped on a visual component is a very common operation that is needed in many games. It could be user interaction with a button or other UI element or the interaction with a game object such as a player controlled unit in a strategy game, some treasure on a level in a dungeon crawler or a quest giver in an RPG. The approach to use varies depending on the type of visual component.
+游戏里经常可见拾取操作. 可能是玩家点击界面按钮或者战略游戏里玩家选取一个作战单位, RPG 游戏点取宝箱等等. 不同组件有不同解决方法.
 
-### Detecting interaction with GUI nodes
+### 界面点击检测
 
-For UI elements there is the `gui.pick_node(node, x, y)` function that will return true or false depending on if the specified coordinate is within the bounds of a gui node or not. Refer to the [API docs](/ref/gui/#gui.pick_node:node-x-y), the [pointer over example](https://www.defold.com/examples/pointer_over/) or the [button example](https://www.defold.com/examples/button/) to learn more.
+界面有一个 `gui.pick_node(node, x, y)` 函数来判断点击输入是否处在某个节点范围之内. 详见 [API 文档](/ref/gui/#gui.pick_node:node-x-y), [指针悬停示例](https://www.defold.com/examples/pointer_over/) 或者 [按钮示例](https://www.defold.com/examples/button/).
 
-### Detecting interaction with game objects
-For game objects it is more complicated to detect interaction since things such as camera translation and render script projection will impact the required calculations. There are two general approaches to detecting interaction with game objects:
+### 游戏对象点击检测
+游戏对象检测有点复杂, 因为摄像机移动和渲染脚本映射都会影响位置计算. 方法主要分为两种:
 
-  1. Track the position and size of game objects the user can interact with and check if the mouse or touch coordinate is within the bounds of any of the objects.
-  2. Attach collision objects to game objects the user can interact with and one collision object that follows the mouse or finger and check for collisions between them.
+  1. 追踪游戏对象的位置和大小然后检测点选位置是否包含在内.
+  2. 给游戏对象加入碰撞组件再在点选位置生成一个碰撞对象检查二者碰撞情况.
 
-::: sidenote
-A ready to use solution for using collision objects to detect user input can be found in the [Defold-Input library asset](https://github.com/britzl/defold-input).
+::: 注意
+公共资源 [Defold 输入库](https://github.com/britzl/defold-input) 是一个开箱即用的输入检测库.
 :::
 
-In both cases there is a need to convert from the screen space coordinates of the mouse or touch event and the world space coordinates of the game objects. This can be done in a couple of different ways:
+无论哪种方案都必须将鼠标手点选的屏幕坐标转换成游戏对象的世界坐标. 实现思路如下:
 
-  * Manually keep track of which view and projection that is used by the render script and use this to convert to and from world space. See the [camera manual for an example of this](/manuals/camera/#converting-mouse-to-world-coordinates).
-  * Use a [third-party camera solution](/manuals/camera/#third-party-camera-solutions) and make use of the provided screen-to-world conversion functions.
+  * 手动跟踪渲染脚本使用的视口和投射用以进行坐标转换. 详见 [摄像机教程的这个示例](/manuals/camera/#鼠标位置转换为世界坐标).
+  * 使用 [第三方摄像机解决方案](/manuals/camera/#第三方摄像机解决方案) 里面的屏幕到世界坐标转换函数.
 
 
-## Gamepads settings file
+## 游戏手柄配置文件
 
-Gamepad mappings for specific hardware gamepads are set in a *gamepads* file. Defold ships with a built in gamepads file with settings for common gamepads:
+游戏手柄配置保存在 *gamepads* 文件里. Defold 自带一个通用手柄配置文件:
 
 ![Gamepad settings](images/input/gamepads.png){srcset="images/input/[email protected] 2x"}
 
-If you need to create a new gamepad settings file, we have a simple tool to help:
+如需自定义手柄配置, 这里有个工具可供使用:
 
-[Click to download gdc.zip](https://forum.defold.com/t/big-thread-of-gamepad-testing/56032).
+[gdc.zip](https://forum.defold.com/t/big-thread-of-gamepad-testing/56032).
 
-It includes binaries for Windows, Linux and macOS. Run it from the command line:
+其中包含可运行于 Windows, Linux 和 macOS 上的可执行文件. 从命令行打开:
 
 ```sh
 ./gdc
 ```
 
-The tool will ask you to press different buttons on your connected controller. It will then output a new gamepads file with correct mappings for your controller. Save the new file, or merge it with your existing gamepads file, then update the setting in "game.project":
+工具提示你按下手柄某个按键. 然后输出配置文件. 保存这个文件, 并在 "game.project" 里引用它:
 
 ![Gamepad settings](images/input/gamepad_setting.png){srcset="images/input/[email protected] 2x"}

+ 1 - 1
docs/zh/manuals/introduction.md

@@ -9,7 +9,7 @@ Defold 是提供设计, 编译和发布游戏功能的一站式工具. 具体功
 
 我们致力于使游戏开发阶段尽可能的有效率, 这使得 Defold 在诸多游戏引擎中脱颖而出. 请看 [使用 Defold 的理由](/why).
 
-## 从开始?
+## 从开始?
 
 我们建议你先尝试一下, 学习手册, 阅读教程和 API 文档, 然后到官方论坛里向他人积极取经并且关注 Defold 的每次更新公告. 教程材料多多, 如果还不知道从哪下手, 建议学学下面的内容:
 

+ 2 - 2
docs/zh/manuals/ios.md

@@ -76,7 +76,7 @@ Device identifier (UDID)
 
 档案过期后, 可以在 Xcode 里如法炮制再次生成临时档案文件.
 
-## 打包 iOS 应用
+## iOS应用打包
 
 如果你有加密证书和这个供应商档案文件, 就可以在编辑器里打包应用了. 从菜单中选择 <kbd>Project ▸ Bundle... ▸ iOS Application...</kbd>.
 
@@ -92,7 +92,7 @@ Device identifier (UDID)
 
 ![ipa iOS application bundle](images/ios/ipa_file.png){.left}
 
-可以在 *game.project* 项目配置文件的 [iOS 部分](/manuals/project-settings/#ios) 设置应用的图标, 启动屏幕 storyboard 等等.
+可以在 *game.project* 项目配置文件的 [iOS 部分](/manuals/project-settings/#iOS) 设置应用的图标, 启动屏幕 storyboard 等等.
 
 ### 创建 storyboard
 

+ 1 - 1
docs/zh/manuals/linux.md

@@ -10,7 +10,7 @@ brief: 本教程介绍了如何在 Linux 上编译运行 Defold 游戏
 
 ## 项目配置
 
-Linux 相关设置位于 *game.project* 文件的 [Linux 部分](/manuals/project-settings/#linux).
+Linux 相关设置位于 *game.project* 文件的 Linux 部分.
 
 ## 问答
 :[Linux 问答](../shared/linux-faq.md)

+ 110 - 110
docs/zh/manuals/live-update.md

@@ -3,50 +3,50 @@ title: Defold 的热更新
 brief: 热更新允许游戏运行时获取和存储编译时并不存在的资源. 本教程介绍了热更新的用法.
 ---
 
-# 目前热更新机制正在升级, 本教程可能随时变化
+#### 目前热更新机制正在升级, 本教程可能随时变化
 
-# Live update
+# 热更新
 
-When bundling a game, Defold packs all the game resources into the resulting platform specific package. In most cases this is preferred since the running engine has instant access to all resources and can load them swiftly from storage. However, there are instances where you might want to postpone the loading of resources to a later stage. For instance:
+打包游戏时, Defold 把所有游戏资源装进游戏包当中. 多数情况下这样做很好因为游戏运行时引擎要快速找到加载所需要的各种资源. 但是, 有一些情况下需要将资源加载推迟到后续阶段. 比如:
 
-- Your game features a series of episodes and you wish to include only the first one for players to try out before they decide if they want to continue with the rest of the game.
-- Your game is targeted for HTML5. On the browser, loading an application from storage means that the entire application package has to be downloaded before startup. On such a platform you may wish to send a minimal start package and get the app up and running quickly before you download the rest of the game resources.
-- Your game contains very large resources (images, videos etc) that you wish to postpone the downloading of until they are about to show in the game. This is to keep the install size down.
+- 你的游戏设计了好几个章节但是只免费提供第一章节给玩家试玩以便让玩家决定是否购买游戏的后续章节.
+- 你做了个 HTML5 游戏. 在浏览器里, 一个程序的所有内容全部加载完成这个程序才能运行. 可以用一个小程序让游戏先展示出来, 大量自由数据下载留到后面再说.
+- 你的游戏包含大量资源数据 (图片, 视频之类的) 所以需要一种按需求的下载和加载机制. 这样就能保证游戏包不会太大.
 
-The Live update functionality expands the concept of the collection proxy with a mechanism allowing the runtime to fetch and store resources to the application bundle that were intentionally left out of the bundle at build time.
+热更新扩展了集合代理的概念允许引擎在运行时获取和存储未被打入游戏包的资源数据.
 
-## Preparing content for Live update
+## 准备工作
 
-Suppose we are making a game containing large, high resolution image resources. The game keeps these images in collections with a game object and a sprite with the image:
+假设我们有个很大的, 高分辨率的图片. 图片放在sprite里, sprite放在游戏对象里, 游戏对象放在集合里:
 
 ![Mona Lisa collection](images/live-update/mona-lisa.png)
 
-To have the engine load such a collection dynamically, we can simply add a collection proxy component and point it to *monalisa.collection*. Now the game can choose when to load the content in the collection from storage into memory by sending a `load` message to the collection proxy. However, we want to go further and control the loading of the resources contained in the collection ourselves.
+动态加载这个集合, 只需使用集合代理组件并将它指向 *monalisa.collection* 即可. 集合里的资源合适加载入内存取决于发给集合代理的 `load` 消息. 如果要进一步控制资源文件的话,
 
-This is done by simply checking the *Exclude* checkbox in the collection proxy properties, telling the bundler to leave any content in *monalisa.collection* out when creating an application bundle.
+勾选集合代理属性 *Exclude* 即可, 打包时会把 *monalisa.collection* 的内容排除于包外.
 
 ![Collection proxy excluded](images/live-update/proxy-excluded.png)
 
-## Live update settings
+## 热更新配置
 
-When the bundler creates an application bundle it needs to store any excluded resources somewhere. The project settings for Live update govern the location for those resources. The settings are found under <kbd>Project ▸ Live update Settings...</kbd>. This will create a settings file if none exists. In `game.project`, select which liveupdate settings file to use when bundling. This allows for using different liveupdate settings for different environments, for example for live, QA, dev etc.
+游戏打包时需要知道把包外的资源保存在哪里了. 项目设置里的热更新配置明确了这个保存位置. 点击 <kbd>Project ▸ Live update Settings...</kbd> 来创建热更新配置文件. 在 `game.project` 里, 指定打包时所使用的热更新配置文件. 不同运行环境可以对于不同配置, 比如游戏环境, 测试环境, 开发环境等.
 
 ![Live update settings](images/live-update/aws-settings.png)
 
-There are currently two ways that Defold can store the resources. Choose the method in the *Mode* dropdown in the settings window:
+目前 Defold 支持两种包外资源的保存模式. 可以在设置窗口里的 *Mode* 下拉菜单中选择:
 
 `Amazon`
-: This option tells Defold to automatically upload excluded resources to an Amazon Web Service (AWS) S3 bucket. Fill in your AWS *Credential profile* name, select the appropriate *Bucket* and provide a *Prefix* name. [See below for details how to set up an AWS account](#setting_up_amazon_web_service).
+: 让 Defold 自动把包外资源上传到 Amazon Web Service (AWS) S3 服务器上. 填写 AWS *凭证* 名, 选择合适的 *服务器* 在提供一个 *前缀* 名. [关于 AWS 账户注册请见下文](#setting_up_amazon_web_service).
 
 `Zip`
-: This option tells Defold to create a Zip archive file with any excluded resources. The archive is saved at the location specified in the *Export path* setting.
+: 让 Defold 把包外资源打成 zip 包. 并且在配置里 *Export path* 项指定存放路径.
 
 
-## Scripting with excluded collection proxies
+## 热更新脚本
 
-A collection proxy that has been excluded from bundling works as a normal collection proxy, with one important difference. Sending it a `load` message while it still has resources not available in the bundle storage will cause it to fail.
+热更新集合代理和普通集合代理差不多, 只是有一个重要区别. 如果在资源还没下载好的时候发送 `load` 消息的话就会导致失败报错.
 
-So before we send it a `load`, we need to check if there are any missing resources. If there are, we have to download them and then store them. The following example code assumes that the resources are stored on Amazon S3, in a bucket called "my-game-bucket" with the prefix `my-resources`.
+所以发送 `load` 之前, 一定要确保资源的完整性. 把完整的资源下载并保存好. 一下代码假设资源保存在 Amazon S3, 一个叫做 "my-game-bucket" 的服务器上, 前缀为 `my-resources`.
 
 ```lua
 function init(self)
@@ -54,22 +54,21 @@ function init(self)
     msg.post("#", "attempt_load_resources")
 end
 
--- This function is called whenever we have tried to store a downloaded resource
--- necessary for our collection proxy to load.
+-- 下载热更新用到的包外资源进行本地保存时会调用此函数
 local function resource_store_response(self, hexdigest, status)
     if status == true then
-        -- Successfully loaded resource
+        -- 加载成功
         print("Resource data stored: " .. hexdigest)
 
-        -- One less resource to go...
+        -- 还差一个资源
         self.resources_pending = self.resources_pending - 1
 
-        -- That was all of them, time to load the proxied collection.
+        -- 全部保存好了, 可以开始加载了
         if self.resources_pending == 0 then
             msg.post("#proxy", "load") -- <8>
         end
     else
-        -- ERROR! Failed to store the data!
+        -- 错误! 资源数据保存失败.
         print("Failed to store resource data: " .. hexdigest)
     end
 end
@@ -78,14 +77,14 @@ function on_message(self, message_id, message, sender)
     if message_id == hash("attempt_load_resources") then
         local missing_resources = collectionproxy.missing_resources("#proxy") -- <2>
 
-        -- initiate a download request for each of the missing resources that has not yet been tried.
+        -- 为缺失的而且没被尝试下载过的资源初始化下载请求.
         for _,resource_hash in ipairs(missing_resources) do
             msg.post("#", "attempt_download", { resource_hash = resource_hash})
         end
 
         self.resources_pending = #missing_resources -- <3>
 
-        -- if we're running from editor all resources are there from the start.
+        -- 如果游戏是从编辑器运行的, 那么全部资源都存在本地.
         if self.resources_pending == 0 then
             msg.post("#proxy", "load")
         end
@@ -94,11 +93,11 @@ function on_message(self, message_id, message, sender)
         local base_url = "https://my-game-bucket.s3.amazonaws.com/my-resources/" -- <5>
         http.request(base_url .. message.resource_hash, "GET", function(self, id, response)
             if response.status == 200 or response.status == 304 then -- <6>
-                -- We got the response ok.
+                -- 得到ok响应.
                 print("storing " .. message.resource_hash)
                 resource.store_resource(manifest, response.response, message.resource_hash, resource_store_response) -- <7>
             else
-                -- ERROR! Failed to download resource!
+                -- 错误! 资源下载失败.
                 print("Failed to download resource: " .. message.resource_hash)
             end
         end)
@@ -108,76 +107,76 @@ function on_message(self, message_id, message, sender)
     end
 end
 ```
-1. A simple counter that tells us how many resources we have still to download and store before we can load the proxy collection. Note that this code does not deal with errors at all so production code would need to do a better job at tracking the download and store operations.
-2. Get any resources that we need to download and store.
-3. Store the number of missing resources so we can count them down.
-4. We need the current manifest since it lists all resources in the bundle, and if they are available or not.
-5. We store our resources on Amazon S3. If you create a Zip archive with resources, you need to host the files somewhere and reference their location when downloading them with `http.request()`.
-6. Amazon returns status 304 when files are cached.
-7. We have data at this point. Try to store it.
-8. Storage was successful and we have decreased the resource counter to zero. It is now safe to send a "load" message to the collection proxy. Note that if download or storage fails at some point, the counter will never reach zero.
+1. 一个计数器记录了还剩多少资源需要下载保存. 注意此处未做错误处理, 产品级游戏要跟踪好下载和保存的各种情况.
+2. 得到需要下载保存的资源.
+3. 计数器更新.
+4. 资源需求清单.
+5. 本例中资源保存于 Amazon S3. 如果使用zip包保存资源, 需要调用 `http.request()` 连同资源托管地址进行下载.
+6. 文件缓存好之后 Amazon 返回状态 304.
+7. 下载完成, 开始保存.
+8. 保存成功, 资源计数器清零. 此时可以放心发送 "load" 消息给集合代理. 注意如果下载保存任何地方出错, 计数器都不会清零.
 
-With the loading code in place, we can test the application. However, running it from the editor will not download anything. This is because Live update is a bundle feature. When running in the editor environment no resources are ever excluded. To make sure everything works fine, we need to create a bundle.
+一切准备就绪, 我们可以尝试启动这个程序. 但是从编辑器运行并不会下载任何东西. 因为热更新是游戏包的功能. 编辑器运行时游戏未打包. 所以, 要测试热更新必须先给游戏打包.
 
-## Bundling with Live update
+## 热更新应用打包
 
-To bundle with Live update is easy. Select <kbd>Project ▸ Bundle ▸ ...</kbd> and then the platform you want to create an application bundle for. This opens the bundling dialog:
+打包很简单. 选择 <kbd>Project ▸ Bundle ▸ ...</kbd> 然后选择目标平台. 此时会弹出对话框:
 
 ![Bundle Live application](images/live-update/bundle-app.png)
 
-When bundling, any excluded resource will be left out of the application bundle. By checking the *Publish Live update content* checkbox, you tell Defold to either upload the excluded resources to Amazon or to create a Zip archive, depending on how you have set up your Live update settings (see above). The manifest file for the bundle will also be included in the excluded resources.
+打包时, 指定资源被排除在包外. 勾选 *Publish Live update content*, 来让 Defold 把包外资源自动上传给 Amazon 或者打成zip包, 取决于热更新配置 (见上文). 资源清单也会被生成出来.
 
-Click *Package* and select a location for the application bundle. Now you can start the application and check that everything works as expected.
+点击 *Package* 然后指定保存位置. 打包好之后就能测试热更新功能了.
 
-## The manifest
+## 清单文件
 
-The manifest is an internal data structure that holds a list of all resources included in a build as well as the hash value of each resource. The Live update functionality uses the manifest to track what is part of the built game, list what can be loaded from external sources, and if that happens, make certain that the loaded data is intact.
+清单是一种内部数据结构用来保存编译所需的所有资源列表连同每个资源的哈希值. 热更新使用清单来确定哪些资源是游戏的一部分, 哪些资源不在本地需要下载, 还要确定下载的资源是否完整.
 
-From the user's perspective, the manifest is a numeric handle, leaving the details of how it's managed to the engine.
+从用户角度来看, 清单是一个数字句柄, 将如何管理资源的细节留给引擎去做.
 
-## Updating the manifest with Live update
+## 清单更新
 
-With Live update a new manifest can be stored locally at runtime. The local manifest will be used at app startup instead of the one bundled with the application. This is useful for modifying or adding Live update resources to a published game that were not known at build time, without having to publish a full release.
+每次热更新都会在本地保存一份更新的清单. 应用启动时会使用最新的清单代替包内的清单. 这对于游戏后续通过热更新来修改增添资源很重要, 尤其是第一版游戏打包时并不知道的资源.
 
-When publishing Live update resources to either Amazon Web Service or to a zip archive, the manifest will be included in that package next to the resources. The name of the manifest file will be `liveupdate.game.dmanifest`.
+当把资源上传到 Amazon 服务器或打包成zip资源包的时候, 清单也会被加入到那些资源当中. 名称为 `liveupdate.game.dmanifest`.
 
-Starting the engine for the first time after a manifest has been stored will create a bundle identifier file `bundle.ver` next to the manifest. This is used to detect whether the bundle has changed since the manifest was stored, for example after a full app store update. If this is the case the stored manifest will be deleted from the filesystem and the newer bundled manifest will be used instead. This means that a full app store update will delete any previously stored manifest. Any existing Live update resources will however remain untouched.
+保存清单后首次启动引擎时会生成一个游戏包版本文件 `bundle.ver`. 用来判断保存清单之后游戏有无改动, 比如说一次完整的 app store 更新. 如果是这样的话清单将从文件系统中删除并使用更新版本游戏包中的清单代替. 也就是说完整 app store 更新会清除上次保存的清单. 而通过热更新下载到本地的资源不被清除.
 
-### Manifest verification
-When storing a new manifest the manifest data will be verified before it is actually written to disk. The verification consists of a number of checks:
+### 清单验证
+保存新版清单之前会对其进行验证. 验证包括如下内容:
 
-* Correct binary file format.
-* Supports the currently running engine version or any other supported version entry from the settings.
-* Cryptographic signature.
-* Signed using the same public-private key pair as the bundled manifest.
-* Verify that all resources the manifest expects to be in the bundle actually are in the bundle.
+* 二进制文件格式是否正确.
+* 引擎版本是否正确.
+* 清单签名是否正确.
+* 新旧文件签名所用的公钥私钥是否一致.
+* 清单列出的资源是否齐全.
 
-From the user's perspective the verification process is completely opaque but it is important to note the steps involved to avoid the most common pitfalls.
+从用户角度来看, 验证过程不必深入了解, 但是要知道验证内容, 以便遇到错误时可以及时修复.
 
-::: important
-If you see a "ERROR:RESOURCE: Byte mismatch in decrypted manifest signature. Different keys used for signing?" error in the console on HTML5 builds it is likely that your webserver doesn't serve the excluded content or updated manifest file using the correct MIME type. Make sure the MIME type is `application/octet-stream`. You can add a `.htaccess` file with a single `AddType application/octet-stream .` line to the folder where the live update resources are downloaded from.
+::: 注意
+如果遇到 "ERROR:RESOURCE: Byte mismatch in decrypted manifest signature. Different keys used for signing?" 错误很有可能是因为你的服务器对包外资源和清单文件的 MIME 类型设置错误. 确保 MIME 类型为 `application/octet-stream`. 可以使用 `.htaccess` 文件加上一条 `AddType application/octet-stream .` 关联到资源和清单文件所在文件夹.
 :::
 
-### Supported engine versions
-A manifest will always support the Defold version used when generating it. If you want to support any additional engine versions, add them to the list in the Live update settings. This can be useful if your live game uses a different Defold version than the one you are using to generate the manifest with.
+### 引擎版本
+清单文件支持生成它的 Defold 版本. 如果希望它支持更多版本, 需要在热更新配置里手动添加. 如果你的游戏需要多版本客户端同时在线, 这一步设定很重要.
 
 ![Manifest supported engine versions](images/live-update/engine-versions-settings.png)
 
-### Generating keys for signing
-The manifest signature is used to verify that no one with malicious intent has tampered with the content, and that the bundled manifest and the new manifest were signed using the same keys. The signing is done as a part of the bundling process.
-A public/private key pair is used to cryptographically sign the manifest. Signing uses 512/1024/2048-bit RSA keys in `.der`-format that the user needs to supply. You can generate these using the `openssl` tool:
+### 签名密钥
+清单签名用来保证游戏内容没有被恶意篡改, 还要确保新旧清单文件签名所用的密钥是相同的. 编译时签名自动生成.
+清单签名使用一对公私密钥. 用户需要提供 `.der` 格式 512/1024/2048-bit RSA 密钥. 可以使用 `openssl` 工具生成密钥:
 
 ```sh
 $ openssl genrsa -out private_raw.key 1024
 $ openssl pkcs8 -topk8 -inform pem -in private_raw.key -outform der -nocrypt -out private.der
 $ openssl rsa -in private_raw.key -outform DER -RSAPublicKey_out -pubout -out public.der
 ```
-This will output `private_raw.key` (can be safely deleted), `private.der`, and `public.der`. To use the keys for signing open the Live update settings view and point respective fields to the generated keys.
+输出文件为 `private_raw.key` (可以删除), `private.der` 和 `public.der`. 然后在热更新配置里指定密钥位置.
 
 ![Manifest signature key-pair](images/live-update/manifest-keys.png)
 
-### Scripting with Live update manifest
-Adding to the scripting example above, we add the following callback function
+### 热更新清单脚本
+接上文热更新脚本, 加入以下回调函数:
 
 ```lua
 local function store_manifest_cb(self, status)
@@ -189,7 +188,7 @@ local function store_manifest_cb(self, status)
 end
 ```
 
-and the following to ```on_message``` to handle message ```attempt_download_manifest```:
+然后在 ```on_message``` 里加入处理 ```attempt_download_manifest``` 的代码:
 
 ```lua
 ...
@@ -197,43 +196,43 @@ elseif message_id == hash("attempt_download_manifest") then
     local base_url = "https://my-game-bucket.s3.amazonaws.com/my-resources/" -- <1>
     http.request(base_url .. MANIFEST_FILENAME, "GET", function(self, id, response)
         if response.status == 200 or response.status == 304 then
-            -- We got the response ok.
+            -- 响应 ok.
             print("verifying and storing manifest " .. MANIFEST_FILENAME)
             resource.store_manifest(response.response, store_manifest_cb) -- <2>
         else
-            -- ERROR! Failed to download manifest!
+            -- 错误! 清单下载失败.
             print("Failed to download manifest: " .. MANIFEST_FILENAME)
         end
     end)
 end
 ```
-1. The manifest will be stored on S3 next to the rest of the Live update resources. As before, if you create a Zip archive with resources you need to host the files somewhere and reference their location when downloading them with `http.request()`.
-2. Similar to how resources are downloaded and stored, the call to `resource.store_manifest` takes the downloaded manifest data and a callback as arguments. The function will verify the manifest and persist it to local storage.
+1. 清单文件要跟热更新资源保存在一起. 无论是保存在S3服务器还是打zip包.
+2. 跟资源文件下载保存类似, 调用 `resource.store_manifest` 下载清单数据传入回调函数. 下载验证后保存在本地.
 
-If `resource.store_manifest` succeeds, the new manifest is now located in local storage. The next time the engine starts this manifest will be used instead of the one bundled with the game.
+如果 `resource.store_manifest` 成功, 清单已保存在本地. 下次游戏启动会自动使用新清单文件代替包内旧清单文件.
 
-### Caveats
-There are a few gotchas that might be good to know if you plan to use this feature to store a new manifest with Live update.
+### 注意事项
+更新清单文件要注意几个事项.
 
-* It is only possible to add or modify resources referenced by collection proxies that are tagged as `Exclude` in the new manifest. No changes should be made to already bundled resources or resources not in excluded collection proxies. For example, doing changes in a script that is referenced by a bundled collection will cause the resource system to look for that resource in the bundled data archive. But since the shipped game bundle has not changed (only the manifest has) the changed script will not be found and consequently cannot be loaded.
+* 只能添加或修改集合代理中被设置为 `Exclude` 的资源. 包内资源和集合代理未设置排除的资源不可更改. 比如清单列表要更新包内脚本, 但是因为包内资源不变 (只有清单更新了), 无法在包内找到新脚本, 更新肯定不会成功.
 
-* Even though this feature allows you to quickly push bug fixes or new features to a live game without doing a full app store release, it should be used with care. Pushing out a new manifest should involve the same processes as when doing a full release with everything that that entails (testing, QA, etc.).
+* 热更新方便快捷, 但是使用时要多加留意. 热更新也是更新, 发布前也要做测试等工作.
 
-## Setting up Amazon Web Service
+## 创建 Amazon 网络服务器
 
-To use the Defold Live update feature together with Amazon services you need an Amazon Web Services account. If you don't already have an account you can create one here https://aws.amazon.com/.
+要使用 Defold 配合 Amazon 服务器进行热更新首先要有 Amazon Web Services 账户. 没有的话请在这里注册: https://aws.amazon.com/.
 
-This section will explain how to create a new user with limited access on Amazon Web Services that can be used together with the Defold editor to automatically upload Live update resources when you bundle your game, as well as how to configure Amazon S3 to allow game clients to retrieve resources. For additional information about how you can configure Amazon S3, please see the [Amazon S3 documentation](http://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html).
+这里介绍一下如何开通 Amazon 服务以配合 Defold 进行热更新, 在 Amazon S3 需要那些配置. 更多关于 Amazon S3 的信息, 请参考 [Amazon S3 文档](http://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html).
 
-1. Create a bucket for Live update resources
-
-    Open up the `Services` menu and select `S3` which is located under the _Storage_ category ([Amazon S3 Console](https://console.aws.amazon.com/s3)). You will see all your existing buckets together with the option to create a new bucket. Though it is possible to use an existing bucket, we recommend that you create a new bucket for Live update resources so that you can easily restrict access.
+1. 开通服务
 
+    在 _Storage_ 类目 ([Amazon S3 Console](https://console.aws.amazon.com/s3)) 下打开 `Services` 菜单选择 `S3`. 页面上会列出已存在的所有服务器与开通新服务器的选项. 使用已存在的服务器是可以的, 但是建议为热更新资源创建一个新服务器,以便设置访问限制.
+    
     ![Create a bucket](images/live-update/01-create-bucket.png)
 
-2. Add a bucket policy to your bucket
+2. 服务配置
 
-    Select the bucket you wish to use, open the *Properties* panel and expand the *Permissions* option within the panel. Open up the bucket policy by clicking on the *Add bucket policy* button. The bucket policy in this example will allow an anonymous user to retrieve files from the bucket, which will allow a game client to download the Live update resources that are required by the game. For additional information about bucket policies, please see [the Amazon documentation](https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html).
+    开通服务器, 打开 *Properties* 面板展开折叠的 *Permissions* 选项. 点击 *Add bucket policy* 按钮添加配置文件. 本例中的配置是允许任何客户端访问服务器资源, 以便热更新顺利工作. 更多配置信息, 请参考 [Amazon 文档](https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html).
 
     ```json
     {
@@ -252,11 +251,11 @@ This section will explain how to create a new user with limited access on Amazon
 
     ![Bucket policy](images/live-update/02-bucket-policy.png)
 
-3. Add a CORS configuration to your bucket (Optional)
+3. 添加 CORS 配置 (可选)
 
-    [Cross-Origin Resource Sharing (CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) is a mechanism that allows a website to retrieve a resource from a different domain using JavaScript. If you intend to publish your game as an HTML5 client, you will need to add a CORS configuration to your bucket.
+    [Cross-Origin Resource Sharing (CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) 是一种能让服务器使用 JavaScript 访问另一服务器资源的机制. 如果你发布的是 HTML5 游戏, 就需要给服务器添加 CORS 配置.
 
-    Select the bucket you wish to use, open the *Properties* panel and expand the *Permissions* option within the panel. Open up the bucket policy by clicking on the *Add CORS Configuration* button. The configuration in this example will allow access from any website by specifying a wildcard domain, though it is possible to restrict this access further if you know on which domains you will make you game available. For additional information about Amazon CORS configuration, please see [the Amazon documentation](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html).
+    选择服务器, 打开 *Properties* 面板展开折叠的 *Permissions* 选项. 点击 *Add CORS Configuration* 按钮添加 CORS 配置. 本例中的配置是允许任何服务器访问本服务器资源, 如果需要可以做详细的限制. 更多 Amazon CORS 配置信息, 请参考 [Amazon 文档](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html).
 
     ```xml
     <?xml version="1.0" encoding="UTF-8"?>
@@ -270,11 +269,11 @@ This section will explain how to create a new user with limited access on Amazon
 
     ![CORS configuration](images/live-update/03-cors-configuration.png)
 
-4. Create IAM policy
+4. 创建 IAM 配置
 
-    Open up the *Services* menu and select *IAM* which is located under the _Security, Identity & Compliance_ category ([Amazon IAM Console](https://console.aws.amazon.com/iam)). Select *Policies* in the menu to the left and you will see all your existing policies together with the option to create a new policy.
+    打开 *Services* 菜单, 在 _Security, Identity & Compliance_ 类目 ([Amazon IAM Console](https://console.aws.amazon.com/iam)) 下打开 *IAM*. 选择左边的 *Policies*, 页面会列出已存在的所有 IAM 配置与创建新配置的选项.
 
-    Click the button *Create Policy*, and then choose to _Create Your Own Policy_. The policy in this example will allow a user to list all buckets, which is only required when configuring a Defold project for Live update. It will also allow the user to get the Access Control List (ACL) and upload resources to the specific bucket used for Live update resources. For additional information about Amazon Identity and Access Management (IAM), please see [the Amazon documentation](http://docs.aws.amazon.com/IAM/latest/UserGuide/access.html).
+    点击 *Create Policy* 按钮, 选择 _Create Your Own Policy_. 本例中的配置是允许用户获得服务器列表, 这是 Defold 热更新的必要配置. 这里还可以允许用户获得 Access Control List (ACL) 和把资源文件上传至服务器的权力. 关于 Amazon Identity and Access Management (IAM) 的更多信息, 详见 [Amazon 文档](http://docs.aws.amazon.com/IAM/latest/UserGuide/access.html).
 
     ```json
     {
@@ -307,30 +306,30 @@ This section will explain how to create a new user with limited access on Amazon
 
     ![IAM policy](images/live-update/04-create-policy.png)
 
-5. Create a user for programmatic access
+5. 创建管理账户
 
-    Open up the *Services* menu and select *IAM* which is located under the _Security, Identity & Compliance_ category ([Amazon IAM Console](https://console.aws.amazon.com/iam)). Select *Users* in the menu to the left and you will see all your existing users together with the option to add a new user. Though it is possible to use an existing user, we recommend that you add a new user for Live update resources so that you can easily restrict access.
+    打开 *Services* 菜单, 在 _Security, Identity & Compliance_ 类目 ([Amazon IAM Console](https://console.aws.amazon.com/iam)) 下打开 *IAM*. 选择左边的 *Users*, 页面会列出已存在的所有用户与创建新用户的选项. 使用已存在的用户是可以的, 但是建议为热更新资源创建一个新用户,以便设置访问限制.
 
-    Click the button *Add User*, provide a username and choose *Programmatic access* as *Access type*, then press *Next: Permissions*. Select *Attach existing policies directly* and choose the policy you created in step 4.
+    点击 *Add User* 按钮, 输入用户名选择 *Programmatic access* 作为 *Access type*, 然后点击 *Next: Permissions*. 选择 *Attach existing policies directly* 然后选择第4步中所作的配置.
 
-    When you've completed the process you will be provided with an *Access key ID* and a *Secret access key*.
+    完成之后你会得到 *Access key ID* 和 *Secret access key*.
 
-    ::: important
-    It is *very important* that you store those keys since you will not be able to retrieve them from Amazon after you leave the page.
+    ::: 注意
+    保存好密匙 *非常重要* 因为离开 Amazon 页面后就无法再次获得密匙了.
     :::
 
-6. Create a credentials profile file
+6. 创建档案文件
 
-    At this point you should have created a bucket, configured a bucket policy, added a CORS configuration, created a user policy and created a new user. The only thing that remains is to create a [credentials profile file](https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks) so that the Defold editor can access the bucket on your behalf.
+    此时你已经开启了服务器, 做好了客户端访问配置, 添加了服务端方位配置, 新建了用户权限和一个新用户. 剩下的最后一件事是创建 [档案文件](https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks) 以便让 Defold 也能访问服务器.
 
-    Create a new directory *.aws* in your home folder, and create a file called *credentials* within the new directory.
+    在本地新建一个 *.aws* 文件夹, 在里面新建一个 *credentials* 文件.
 
     ```bash
     $ mkdir ~/.aws
     $ touch ~/.aws/credentials
     ```
 
-    The file *~/.aws/credentials* will contain your credentials to access Amazon Web Services through programmatic access and is a standardised way to manage AWS credentials. Open the file in a text editor and enter your *Access key ID* and *Secret access key* in the format shown below.
+    文件 *~/.aws/credentials* 要包含访问 Amazon 服务所需的凭证即标准 AWS 证书. 打开文件按照如下格式输入你的 *Access key ID* 和 *Secret access key*.
 
     ```ini
     [defold-liveupdate-example]
@@ -338,26 +337,27 @@ This section will explain how to create a new user with limited access on Amazon
     aws_secret_access_key = <Secret access key>
     ```
 
-    The identifier specified within the brackets, in this example _defold-liveupdate-example_, is the same identifier that you should provide when configuring your project's Live update settings in the Defold editor.
+    服务器名, 本例中是 _defold-liveupdate-example_, 在 Defold 编辑器热更新配置里也要提供.
 
     ![Live update settings](images/live-update/05-liveupdate-settings.png)
 
-## Development caveats
+## 开发注意事项
 
-Debugging
-: When running a bundled version of your game, you don't have direct access to a console. This causes problems for debugging. However, you can run the application from the command line or by double clicking the executable in the bundle directly:
+调试
+: 运行打包游戏, 不要直接接入控制台. 这在调试时会产生错误. 但是当你使用命令行或者双击启动的方式启动游戏:
 
   ![Running a bundle application](images/live-update/run-bundle.png)
 
-  Now the game starts with a shell window that will output any `print()` statements:
+  这样游戏里的 `print()` 语句输出都会被打印到控制台上:
 
   ![Console output](images/live-update/run-bundle-console.png)
 
-Forcing re-download of resources
-: When an application stores resources, they end up on disk on the local computer or handheld device. If you restart the application, the resources are there and ready. When developing you might want to remove resources and force the application to download them again.
+强制重新下载资源
+: 游戏保存资源时, 文件被保存在设备本地硬盘上. 重启游戏, 资源文件并不消失. 开发阶段可能会希望删掉这些文件然后强制重新下载.
 
-  Defold creates a folder with the name of the hash of the created bundle on the device in the application support folder. If you delete the files in this folder, the application will invalidate the resources from the manifest and you can download and store them again.
+  Defold 在设备上的应用文件夹下创建了一个以游戏包哈希值为名字的文件夹. 如果删除这个文件夹下的文件, 游戏会自动把清单资源作废然后就可以重新下载重新保存了.
 
   ![Local storage](images/live-update/local-storage.png)
 
-  The location of the application support folder depends on the operating system. It can be found with `print(sys.get_save_file("", ""))`.
+  这个应用文件夹的位置基于操作系统有所不同. 可以运行 `print(sys.get_save_file("", ""))` 脚本查看其路径.
+  

+ 1 - 1
docs/zh/manuals/macos.md

@@ -9,7 +9,7 @@ brief: 本教程介绍了在 macOS 平台上编译和运行 Defold 游戏的方
 
 ## 项目配置
 
-macOS 相关选项位于 *game.project* 配置文件的 [OSX 部分](/manuals/project-settings/#osx).
+macOS 相关选项位于 *game.project* 配置文件的 [OSX 部分](/manuals/project-settings/#MacOS 和 OS X).
 
 ## 应用图标
 

+ 4 - 4
docs/zh/manuals/material.md

@@ -45,12 +45,12 @@ Samplers
 Tags
 : 标签与材质相关. 标签在引擎内部表现为 _bitmask_ 并由 [`render.predicate()`](/ref/render#render.predicate) 来收集需要渲染的组件. 如何渲染请见 [Render documentation](/manuals/render). 每个项目最多可以使用32个标签.
 
-## Vertex and fragment constants
+## 着色器常量
 
-着色器常量, 或称 "uniforms" 是从引擎传输给顶点和片元着色器程序的数据. 要使用常量,您可以在材质文件中将其定义为一个 *顶点常量* 属性或 *片元常量* 属性。需要在着色器程序中定义相应的 `uniform` 变量。材质中可以设置以下常量:
+着色器常量, 或称 "uniforms" 是从引擎传输给顶点和片元着色器程序的数据. 要使用常量,您可以在材质文件中将其定义为一个 *顶点常量* 属性或 *片元常量* 属性.需要在着色器程序中定义相应的 `uniform` 变量.材质中可以设置以下常量:
 
 CONSTANT_TYPE_WORLD
-: 世界矩阵. 用来把顶点转换为世界坐标. 有的组件类型, 由于合批的应用它们到达顶点着色程序时已经是世界坐标的了. 在这些情况下用着色器程序把世界矩阵再乘一遍就会产生错误的结果.
+: 世界矩阵. 用来把顶点转换为世界坐标. 有的组件类型, 由于合批的应用它们到达顶点着色程序时已经是世界坐标的了. 在这些情况下,用着色器程序把世界矩阵再乘一遍就会产生错误的结果.
 
 CONSTANT_TYPE_VIEW
 : 视图矩阵. 用于转换顶点为视口(相机)空间坐标.
@@ -68,7 +68,7 @@ CONSTANT_TYPE_NORMAL
 : 用于计算法方向的矩阵. 世界移动转换可能包含非等比缩放, 这样会打破世界-视口转换的正交性. 变换法线时使用发方向可以避免这个问题. (法矩阵是世界-视口矩阵的转置逆).
 
 CONSTANT_TYPE_USER
-: 一个 vector4 常量用以向你的着色程序传递自定义数据. 定义时可以赋初值, 可以通过各组件 (`sprite`, `model`, `spine`, `particlefx` 和 `tilemap`) 的 `.set_constant()` 和 `.reset_constant()` 函数来改变其值. 改变单个组件实例的材质参数会 [打破合批增加drawcall](/manuals/render/#draw-calls-and-batching).
+: 一个 vector4 常量用以向你的着色程序传递自定义数据. 定义时可以赋初值, 可以通过各组件 (`sprite`, `model`, `spine`, `particlefx` 和 `tilemap`) 的 `.set_constant()` 和 `.reset_constant()` 函数来改变其值. 改变单个组件实例的材质参数会 [打破合批增加drawcall](/manuals/render/#Draw call 与合批).
 <br>举例:
 ```lua
 go.set("#sprite", "tint", vmath.vector4(1,0,0,1))

+ 1 - 1
docs/zh/manuals/optimization.md

@@ -24,7 +24,7 @@ Defold 编译和打包时建立了一个依赖树. 编译系统从 *game.project
 根据 2017 年一项研究表明 "APK 文件大小每增加 6 MB, 安装率就会相应降低 1%." ([source](https://medium.com/googleplaydev/shrinking-apks-growing-installs-5d3fcba23ce2))
 :::
 
-为了更好的分析包体空间占用可以在编译时 [生成编译报告](/manuals/bundling/#build-reports). 通常声音和图片占游戏空间最大部分.
+为了更好的分析包体空间占用可以在编译时 [生成编译报告](/manuals/bundling/#编译报告). 通常声音和图片占游戏空间最大部分.
 
 ### 缩减引擎
 可以使用 [application manifest 文件](https://defold.com/manuals/project-settings/#app-manifest) 去掉引擎中不需要的功能. 比如游戏不用物理效果就去掉物理引擎. 使用 [Manifestation 在线工具](https://britzl.github.io/manifestation/) 可以方便配置和生成这个文件.

+ 86 - 86
docs/zh/manuals/particlefx.md

@@ -12,231 +12,231 @@ brief: 本教程介绍了粒子特效组件的使用以及特效的编辑方法.
 粒子特效包含一些发射器以及可选的修改器:
 
 Emitter
-: 发射器是任意放置的的形状,可发射均匀分布在该形状上的粒子。发射器包含控制粒子生成的属性,比如各个粒子的图像或动画,生命周期,颜色,形状和速度。
+: 发射器是任意放置的的形状,可发射均匀分布在该形状上的粒子.发射器包含控制粒子生成的属性,比如各个粒子的图像或动画,生命周期,颜色,形状和速度.
 
 Modifier
-: 修改器会影响生成的粒子的速度,以使其在特定方向上加速或减速,径向移动或绕点旋转。修改器可以影响单个的粒子或者整个发射器。
+: 修改器会影响生成的粒子的速度,以使其在特定方向上加速或减速,径向移动或绕点旋转.修改器可以影响单个的粒子或者整个发射器.
 
 ## 新建粒子特效
 
-Select <kbd>New... ▸ Particle FX</kbd> from the context menu in the *Assets* browser. Name the new particle effect file. The editor will now open the file using the [Scene Editor](/manuals/editor/#the-scene-editor).
+在  *Assets* 浏览器菜单栏选择 <kbd>New... ▸ Particle FX</kbd>. 为新建粒子特效命名. 编辑器会为其自动打开 [场景编辑器](/manuals/editor/#场景编辑器).
 
-The *Outline* pane shows the default emitter. Select the emitter to bring up its properties in the *Properties* pane below.
+在 *Outline* 面板中显示出默认粒子发射器. 点选发射器 *Properties* 面板会对应更新.
 
 ![Default particles](images/particlefx/default.png){srcset="images/particlefx/[email protected] 2x"}
 
-To add a new emitter to the effect, <kbd>right click</kbd> the root of the *Outline* and select <kbd>Add Emitter ▸ [type]</kbd> from the context menu. Note that you can change the type of the emitter in the emitter properties.
+新建发射器, <kbd>右键点击</kbd> *Outline* 视图, 从上下文菜单中选择 <kbd>Add Emitter ▸ [type]</kbd>. 其中发射器类型可以创建后在属性里更改.
 
-To add a new modifier, <kbd>right click</kbd> the location of the modifier in the *Outline* (the effect root or a particular emitter) and select <kbd>Add Modifier</kbd>, then select the modifier type.
+新建修改器, <kbd>右键点击</kbd> *Outline* 视图里的发射器, 从上下文菜单中选择 <kbd>Add Modifier</kbd>, 再选择修改器类型.
 
 ![Add modifier](images/particlefx/add_modifier.png){srcset="images/particlefx/[email protected] 2x"}
 
 ![Add modifier select](images/particlefx/add_modifier_select.png){srcset="images/particlefx/[email protected] 2x"}
 
-A modifier that sits on the effect root (not childed to an emitter) affects all particles in the effect.
+在根节点 (而不是发射器子级) 上添加的修改器会作用域所有粒子.
 
-A modifier that is added as a child to an emitter affects only that emitter.
+作为在发射器子集添加的修改器只会作用域该发射器的粒子.
 
-## Previewing an effect
+## 预览效果
 
-* Select <kbd>View ▸ Play</kbd> from the menu to preview the effect. You may need to zoom out the camera to see the effect properly.
-* Select <kbd>View ▸ Play</kbd> again to pause the effect.
-* Select <kbd>View ▸ Stop</kbd> to stop the effect. Playing it again restarts it from its initial state.
+* 菜单栏选择 <kbd>View ▸ Play</kbd>. 配合摄像机缩放进行预览.
+* 再次选择 <kbd>View ▸ Play</kbd> 会暂停效果预览.
+* 选择 <kbd>View ▸ Stop</kbd> 结束预览. 再次预览时会重新初始化粒子效果.
 
-When editing an emitter or modifier the result is immediately visible in the editor, even with the effect paused:
+在发射器和修改器上做的属性修改会立即反映在预览之中, 即使是在暂停状态:
 
 ![Edit particles](images/particlefx/rotate.gif)
 
-## Emitter properties
+## 发射器属性
 
 Id
-: Emitter identifier (used when setting render constants for specific emitters).
+: 发射器名 (为发射器设置渲染常量时会用到).
 
 Position/Rotation
-: Transform of the emitter relative the ParticleFX component.
+: 基于粒子特效组件的位置/旋转.
 
 Play Mode
-: Controls how the emitter plays:
-  - `Once` stops the emitter after reaching its duration.
-  - `Loop` restarts the emitter after reaching its duration.
+: 用于控制播放模式:
+  - `Once` 播放结束后即停止.
+  - `Loop` 播放结束后再次播放.
 
 Size Mode
-: Controls how flipbook animations will be sized:
-  - `Auto` keeps the size of each flipbook animation frame to the source image.
-  - `Manual` sets the particle size according to the size property.
+: 用于控制逐帧动画的大小:
+  - `Auto` 基于图片大小.
+  - `Manual` 基于 size 设置.
 
 Emission Space
-: Which geometrical space the spawned particles will exist:
-  - `World` moves the particles independent of the emitter.
-  - `Emitter` moves the particles relative to the emitter.
+: 把粒子发射在哪里:
+  - `World` 世界空间.
+  - `Emitter` 发射器空间.
 
 Duration
-: The number of seconds the emitter should emit particles.
+: 多少秒发射一次粒子.
 
 Start Delay
-: The number of seconds the emitter should wait before emitting particles.
+: 发射前等待多少秒.
 
 Start Offset
-: The number of seconds into the particle simulation the emitter should start, or in other words how long the emitter should pre-warm the effect for.
+: 起始效果偏移秒数, 换句话说就是发射器发射粒子的预热时间.
 
 Image
-: The image file (Tile source or Atlas) to use for texturing and animating the particles.
+: 粒子使用的图片 (来自瓷砖图源或者图集资源).
 
 Animation
-: The animation from the *Image* file to use on the particles.
+: 粒子用的基于 *图片* 的逐帧动画资源文件.
 
 Material
-: The material to use for shading the particles.
+: 粒子材质.
 
 Blend Mode
-: Available blend modes are `Alpha`, `Add` and `Multiply`.
+: 混合模式, 可以选择 `Alpha`, `Add` 或者 `Multiply`.
 
 Max Particle Count
-: How many particles originating from this emitter that can exist at the same time.
+: 当前发射器允许同时存在的最多粒子数量.
 
 Emitter Type
-: The shape of the emitter
-  - `Circle` emits particles from a random location inside a circle. The particles are directed outwards from the center. The circle diameter is defined by *Emitter Size X*.
+: 发射器形状
+  - `Circle` 从圆的内部随机位置发射粒子. 发射方向背向圆心. 圆直径基于 *发射器 Size 的X值*.
 
-  - `2D Cone` emits particles from a random location inside a flat cone (a triangle). The particles are directed out of the top of the cone. *Emitter Size X* defines the width of the top and *Y* defines the height.
+  - `2D Cone` 从锥形(三角形)的内部随机位置发射粒子. 发射方向为锥顶到锥底. 宽度基于 *发射器 Size 的X值*, 高度基于 *Y值*.
 
-  - `Box` emits particles from a random location inside a box. The particles are directed up along the box' local Y-axis. *Emitter Size X*, *Y* and *Z* defines width, height and depth respectively. For a 2D rectangle, keep the Z size at zero.
+  - `Box` 从盒子的内部随机位置发射粒子. 发射方向延盒子本地 Y 轴方向. *发射器 Size 的X值*, *Y值* 和 *Z值* 分别定义宽度, 高度和长度. 如果需要2D矩形, 把Z值设置为0即可.
 
-  - `Sphere` emits particles from a random location inside a sphere. The particles are directed outwards from the center. The sphere diameter is defined by *Emitter Size X*.
+  - `Sphere` 从球体的内部随机位置发射粒子. 发射方向背向球心. 球体的直径基于 *发射器 Size 的X值*.
 
-  - `Cone` emits particles from a random location inside a 3D cone. The particles are directed out through the top disc of the cone. *Emitter Size X* defines the diameter of the top disc and *Y* defines the height of the cone.
+  - `Cone` 从锥体的内部随机位置发射粒子. 发射方向为锥顶到锥底. 宽度基于 *发射器 Size 的X值*, 高度基于 *Y值*.
 
   ![emitter types](images/particlefx/emitter_types.png){srcset="images/particlefx/[email protected] 2x"}
 
 Particle Orientation
-: How the emitted particles are oriented:
-  - `Default` sets the orientation to unit orientation
-  - `Initial Direction` keeps the initial orientation of the emitted particles.
-  - `Movement Direction` adjusts the orientation of the particles according to their velocity.
+: 粒子移动方向:
+  - `Default` 元向量方向
+  - `Initial Direction` 粒子初始化方向.
+  - `Movement Direction` 速度向量方向.
 
 Inherit Velocity
-: A scale value of how much of the velocity of the emitter the particles should inherit. This value is only available when *Space* is set to `World`. The velocity of the emitter is estimated every frame.
+: 粒子继承发射器速度的比例. 仅当 *Space* 设置为 `World` 时有效. 发射器速度每帧更新.
 
 Stretch With Velocity
-: Check to scale any particle stretch in the direction of movement.
+: 延移动方向拉伸粒子.
 
 ### 混合模式
 :[blend-modes](../shared/blend-modes.md)
 
-## Keyable emitter properties
+## 发射器非固定属性
 
-These properties have two fields: a value and a spread. The spread is a variation which is applied randomly for each spawned particle. E.g. if the value is 50 and the spread is 3, each spawned particle will get a value between 47 and 53 (50 +/- 3).
+这种属性分为两个部分: 一个数值和一个抖动. 抖动就是施加于粒子上的随机数值. 比如数值是 50 抖动是 3, 则最终值的范围就是 47 到 53 (50 +/- 3).
 
 ![Property](images/particlefx/property.png){srcset="images/particlefx/[email protected] 2x"}
 
-By checking the key button, the value of the property is controlled by a curve over the duration of the emitter. To reset a keyed property, uncheck the key button.
+点击关键帧按钮, 则属性值由一条曲线决定. 恢复数值加抖动模式, 取消点选关键帧按钮即可.
 
 ![Property keyed](images/particlefx/key.png){srcset="images/particlefx/[email protected] 2x"}
 
-The *Curve Editor* (available among the tabs in the bottom view) is used to modify the curve. Keyed properties can't be edited in the *Properties* view, only in the *Curve Editor*. <kbd>Click and drag</kbd> the points and tangents to modify the shape of the curve. <kbd>Double-click</kbd> on the curve to add control points. To remove a control point, <kbd>double click</kbd> on it.
+*曲线编辑器* (位于视口下方) 用以修改曲线. 这种属性不会显示在 *属性* 视图中, 只能显示在 *曲线编辑器* 中. 通过 <kbd>点击拖动</kbd> 控制点与其切线来修改曲线形状. <kbd>双击</kbd> 曲线添加控制点. <kbd>双击</kbd> 控制点可以删除它.
 
 ![ParticleFX Curve Editor](images/particlefx/curve_editor.png){srcset="images/particlefx/[email protected] 2x"}
 
-To auto-zoom the Curve Editor to display all curves, press <kbd>F</kbd>.
+自动缩放显示完整曲线快捷键为 <kbd>F</kbd>.
 
-The following properties can be keyed over the play time of the emitter:
+以下属性都可以基于发射器发射时间周期用曲线表示:
 
 Spawn Rate
-: The number of particles to emit per second.
+: 每秒发射粒子数.
 
 Emitter Size X/Y/Z
-: The dimensions of the emitter shape, see *Emitter Type* above.
+: 发射器大小, 参考上述 *Emitter Type*.
 
 Particle Life Time
-: The lifespan of each spawned particle, in seconds.
+: 粒子生存周期, 单位是秒.
 
 Initial Speed
-: The initial velocity of each spawned particle.
+: 粒子初始速度.
 
 Initial Size
-: The initial size of each spawned particle. If you set *Size Mode* to `Automatic` and use a flipbook animation as image source, this property is ignored.
+: 粒子初始大小. 如果把 *Size Mode* 设置为 `Automatic` 并且粒子使用基于图片大小的逐帧动画的话, 此属性无效.
 
 Initial Red/Green/Blue/Alpha
-: The initial color component tint values for the particles.
+: 粒子初始颜色及其不透明度.
 
 Initial Rotation
-: The initial rotation values (in degrees) for the particles.
+: 粒子初始角度 (角度制).
 
 Initial Stretch X/Y
-: The initial stretch values (in units) for the particles.
+: 粒子初始拉伸.
 
 Initial Angular Velocity
-: The initial angular velocity  (in degrees/second) of each spawned particle.
+: 粒子初始角速度 (度/每秒).
 
-The following properties can be keyed over the life time of the particles:
+以下属性都可以基于粒子的生命周期用曲线表示:
 
 Life Scale
-: The scale value over each particle's life.
+: 粒子缩放.
 
 Life Red/Green/Blue/Alpha
-: The color component tint value over each particle's life.
+: 粒子颜色及其不透明度.
 
 Life Rotation
-: The rotation value (in degrees) over each particle's life.
+: 粒子旋转角度 (角度制).
 
 Life Stretch X/Y
-: The stretch value (in units) over each particle's life.
+: 粒子拉伸.
 
 Life Angular Velocity
-: The angular velocity (in degrees/second) over each particle's life.
+: 粒子角速度 (度/每秒).
 
-## Modifiers
+## 修改器
 
-There are four types of modifiers available that affect the velocity of particles:
+粒子的速度受以下四种修改器影响:
 
 `Acceleration`
-: Acceleration in a general direction.
+: 在某方向上加速.
 
 `Drag`
-: Reduces the acceleration of particles proportional to the particle velocity.
+: 在粒子方向上的阻尼.
 
 `Radial`
-: Either attracts or repels particles towards/from a position.
+: 在径向方向上吸引或排斥.
 
 `Vortex`
-: Affects particles in a circular or spiraling direction around its position.
+: 让粒子圆周运动或者漩涡式弧线运动.
 
   ![modifiers](images/particlefx/modifiers.png){srcset="images/particlefx/[email protected] 2x"}
 
-## Modifier properties
+## 修改器属性
 
 Position/Rotation
-: The transform of the modifier relative its parent.
+: 修改器相对父级的位移.
 
 Magnitude
-: The amount of effect the modifier has on the particles.
+: 修改器对粒子的影响强度.
 
 Max Distance
-: The maximum distance within which particles are affected at all by this modifier. Only used for Radial and Vortex.
+: 受修改器影响的粒子最远距离. 仅支持 Radial 和 Vortex.
 
-## Controlling a particle effect
+## 控制粒子特效
 
-To start and stop a particle effect from a script:
+开始/停止粒子特效播放的脚本命令:
 
 ```lua
--- start the effect component "particles" in the current game object
+-- 开始当前游戏对象上的粒子特效组件 "particles" 的播放
 particlefx.play("#particles")
 
--- stop the effect component "particles" in the current game object
+-- 停止当前游戏对象上的粒子特效组件 "particles" 的播放
 particlefx.stop("#particles")
 ```
 
-::: sidenote
-A particle effect will continue to emit particles even if the game object the particle effect component belonged to is deleted.
+::: 注意
+即使粒子特效组件依附的游戏对象被删除, 粒子效果也不会停止播放.
 :::
-See the [Particle FX reference documentation](/ref/particlefx) for more information.
+详情请见 [粒子特效索引文档](/ref/particlefx).
 
-## Material constants
+## 材质常量
 
-The default particle effect material has the following constants that can be changed using `particlefx.set_constant()` and reset using `particlefx.reset_constant()` (refer to the [Material manual for more details](/manuals/material/#vertex-and-fragment-constants)):
+粒子特效默认的材质常量可以使用 `particlefx.set_constant()` 和 `particlefx.reset_constant()` 进行设置和重置 (详情请见 [材质教程](/manuals/material/#着色器常量)):
 
 `tint`
-: The color tint of the particle effect (`vector4`). The vector4 is used to represent the tint with x, y, z, and w corresponding to the red, green, blue and alpha tint. Refer to the [API reference for an example](/ref/particlefx/#particlefx.set_constant:url-constant-value).
+: 粒子特效染色 (`vector4`). 四元组的 x, y, z, 和 w 分别对应红, 绿, 蓝和不透明度. 详情请见 [API 文档上的示例](/ref/particlefx/#particlefx.set_constant:url-constant-value).
 
 ## 相关项目配置
 

+ 148 - 145
docs/zh/manuals/physics.md

@@ -1,33 +1,33 @@
 ---
 title: Defold 中的物理系统
-brief: Defold includes physics engines for 2D and 3D. They allow you to simulate Newtonian physics interactions between different types of collision objects. This manual explains how this works.
+brief: Defold 包含的物理引擎可以基于牛顿物理定律模拟物体运动碰撞时的物理效果. 本教程介绍了物理引擎的使用方法.
 ---
 
-# Physics
+# 物理
 
-Defold includes a modified version of the [Box2D](http://www.box2d.org) physics engine (version 2.1) for 2D physics simulations and the Bullet physics engine (version 2.77) for 3D physics. It allows you to simulate Newtonian physics interactions between different types of _collision objects_. This manual explains how this works.
+Defold 包含一个修改版的 [Box2D](http://www.box2d.org) 物理引擎 (版本 2.1) 用于模拟2D物理效果和一个 Bullet physics 引擎 (版本 2.77) 用来模拟3D物理效果. 物理引擎可以基于牛顿物理定律模拟各种 _碰撞物体_ 运动碰撞时的物理效果. 本教程介绍了物理引擎的使用方法.
 
-## Collision objects
+## 碰撞对象
 
-A collision object is a component you use to give a game object physical behaviour. A collision object has physical properties like weight, restitution and friction and its spatial extension is defined by one or more _shapes_ that you attach to the component. Defold supports the following types of collision objects:
+碰撞对象是能给与游戏对象物理行为的组件. 碰撞对象包含许多物理属性比如重量, 弹性, 阻力等等. 组件上定义的一个或多个 _形状_ 决定了它在物理空间中的样子. Defold 支持以下的碰撞对象:
 
 Static objects
-: Static objects never move but a dynamic object that collides with a static object will react by bouncing and/or sliding. Static objects are very useful for building level geometry (i.e. ground and walls) that does not move. They are also cheaper performance-wise than dynamic objects. You cannot move or otherwise change static objects.
+: 静态对象不会移动但是能和移动物体进行碰撞. 静态对象很适合制作游戏固定场景元素 (比如地板和墙). 它们比动态对象性能消耗少. 静态对象不能被移动和修改.
 
 Dynamic objects
-: Dynamic objects are simulated by the physics engine. The engine solves all collisions and applies resulting forces. Dynamic objects are good for objects that should behave realistically but you *cannot* directly manipulate the position and orientation of a dynamic object. The only way to affect them is indirectly, by applying forces.
+: 动态对象由物理引擎负责计算位移. 处理碰撞然后给予力. 动态对象看起来很有真实感但是你 *不能* 直接控制它的位置与方向. 要想对其施加影响, 只能向它施加力的作用.
 
 Kinematic objects
-: Kinematic objects register collisions with other physics objects, but the physics engine do not perform any automatic simulation. The job of resolving collisions, or ignoring them, is left to you. Kinematic objects are very good for player or script controlled objects that require fine grained control of the physical reactions, like a player character.
+: 动画对象可以和其他对象产生碰撞, 但是物理引擎并不处理它们. 忽略碰撞, 或者交给你来处理. 动画对象很适合用作由脚本控制的又能对物理做出反应的物体, 比如游戏角色.
 
 Triggers
-: Triggers are objects that register simple collisions. They are good for objects that just need to register a hit (like a bullet) or as part of game logic where you want to trigger certain actions when an object reaches a specific point. Trigger are computationally cheaper than kinematic objects and should be used in favor of those if possible.
+: 触发器是记录碰撞的物体. 很适合用作碰撞检测 (比如子弹碰撞) 或者接触后触发时间的场景. 触发器比动画对象节省性能所以可以多用一些.
 
-## Adding a collision object component
+## 加入 collision object 组件
 
-A collision object component has a set of *Properties* that sets its type and physics properties. It also contains one or more *Shapes* that define the whole shape of the physics object.
+碰撞对象组件包含一系列 *属性* 用以设定其类型和物理特性. 还包含一个或多个 *形状* 用以定义这个物体的物理形态.
 
-To add a collision object component to a game object:
+在游戏对象上添加碰撞对象组件:
 
 1. In the *Outline* view, <kbd>right click</kbd> the game object and select <kbd>Add Component ▸ Collision Object</kbd> from the context menu. This creates a new component with no shapes.
 2. <kbd>Right click</kbd> the new component and select <kbd>Add Shape ▸ Box / Capsule / Sphere</kbd>. This adds a new shape to the collision object component. You can add any number of shapes to the component. You can also use a tilemap or a convex hull to define the shape of the physics object.
@@ -37,207 +37,209 @@ To add a collision object component to a game object:
 ![Physics collision object](images/physics/collision_object.png){srcset="images/physics/[email protected] 2x"}
 
 Id
-: The identity of the component.
+: 组件名.
 
 Collision Shape
-: This property is used for tile map geometry that does not use ordinary primitive shapes. See below for more information.
+: 这个是针对瓷砖地图的几何形状设置. 详见下文.
 
 Type
-: The type of collision object: `Dynamic`, `Kinematic`, `Static` or `Trigger`. If you set the object to dynamic you _must_ set the *Mass* property to a non zero value. For dynamic or static objects you should also check that the *Friction* and *Restitution* values are good for your use-case.
+: 碰撞对象的类型有: `Dynamic`, `Kinematic`, `Static` 和 `Trigger`. 如果设为动态就 _必须_ 设置其 *Mass* 属性为非0的值. 动态静态碰撞对象都需要为其设置适当的 *Friction* 和 *Restitution* 值.
 
 Friction
-: Friction makes it possible for objects to slide realistically against each other. The friction value is usually set between `0` (no friction at all---a very slippery object) and `1` (strong friction---an abrasive object). However, any positive value is valid.
+: 摩擦可以做出一个物体在另一个物体上滑动的效果. 一般摩擦系数取值范围从 `0` (无摩擦---超级光滑) 到 `1` (强摩擦---超级粗糙) 之间. 但其实任何正数值都有效.
 
-  The friction strength is proportional to the normal force (this is called Coulomb friction). When the friction force is computed between two shapes (`A` and `B`), the friction values of both objects are combined by the geometric mean:
+  摩擦力于法方向上的力成正比 (称为库伦摩擦). 计算两个物体 (`A` 和 `B`) 间的摩擦力时, 摩擦系数取两个物体的几何平均值:
 
   $$
   F_{combined} = \sqrt{ F_A \times F_B }
   $$
 
-  This means that if one of the objects has zero friction then the contact between them will have zero friction.
+  也就是说只要有一个物体是0摩擦的, 两个物体之间就不会有摩擦力.
 
 Restitution
-: The restitution value sets the "bounciness" of the object. The value is usually between 0 (inelastic collision—the object does not bounce at all) and 1 (perfectly elastic collision---the object's velocity will be exactly reflected in the bounce)
+: 弹性是物体的 "反弹性能". 一般取值范围从 0 (非弹性碰撞—一点也不反弹) 到 1 (完全弹性碰撞---物体速度在碰撞后完全反向)
 
-  Restitution values between two shapes (`A` and `B`) are combined using the following formula:
+  两个物体 (`A` 和 `B`) 之间的弹性计算基于以下公式:
 
   $$
   R = \max{ \left( R_A, R_B \right) }
   $$
 
-  When a shape develops multiple contacts, restitution is simulated approximately because Box2D uses an iterative solver. Box2D also uses inelastic collisions when the collision velocity is small to prevent bounce-jitter
+  当一个形状发生多处碰撞时, 弹性模拟并不精确因为 Box2D 使用的是迭代解算器. Box2D 在碰撞相对速度很小时也使用非弹性碰撞代替, 以防止反弹抖动.
 
 
 Linear damping
-: Linear damping reduces the linear velocity of the body. It is different from friction, which only occurs during contact, and can be used to give objects a floaty appearance, like they are moving through something thicker than air. Valid values are between 0 and 1.
+: 线性阻尼会减小刚体的线性速度. 不像摩擦只在物体接触时产生, 线性阻尼始终应用与线性移动的物体上, 给人一种物体飘进比空气密度大的环境中的感觉. 取值范围 0 到 1.
 
-  Box2D approximates damping for stability and performance. At small values, the damping effect is independent of the time step while at larger damping values, the damping effect varies with the time step. If you run your game with a fixed time step, this never becomes an issue.
+  Box2D 并不精确计算阻尼. 值很小时阻尼与时间无关, 值很大时阻尼随时间变化. 如果时间步固定, 这不会造成问题.
 
 Angular damping
-: Angular damping works like linear damping but reduces the angular velocity of the body. Valid values are between 0 and 1.
+: 角阻尼与线性阻尼类似, 不同的是它减小的是刚体角速度. 取值范围 0 到 1.
 
 Locked rotation
-: Setting this property totally disables rotation on the collision object, no matter what forces are brought to it.
+: 关闭碰撞对象的旋转, 无论力如何施加都不会旋转.
 
 Group
-: The name of the collison group the object should belong to. You can have 16 different groups and you name them as you see fit for your game. For example "players", "bullets", "enemies" and "world". If the *Collision Shape* is set to a tile map, this field is not used but the groups names are taken from the tile source.
+: 此碰撞对象所归属的碰撞组. 可以自由定义16个组. 比如 "players", "bullets", "enemies" 或 "world". 如果瓷砖地图上设置了 *Collision Shape*, 则使用的是瓷砖图源里的组名而不是该属性定义的组名.
 
 Mask
-: The other _groups_ this object should collide with. You can name one group or specify multiple groups in a comma separated list. If you leave the Mask field empty, the object will not collide with anything.
+: 可以与此对象进行碰撞的 _组_. 如果指定多个, 组名以逗号分割. 如果值为空, 则此对象不与任何物体进行碰撞.
 
 ### Collision shapes
 
-A collision component can either use several primitive shapes or a single complex shape. The primitive shapes are *box*, *sphere* and *capsule*. A complex shape can either be created from a tilemap component or from a convex hull shape.
+碰撞对象的形状可以由多个简单形状组成也可以由一个复杂形状代替. 简单形状有 *box*, *sphere* 和 *capsule*. 复杂形状可以由瓷砖地图生成或者使用凸多边形.
 
 ### Box shape
-A box has a position, rotation and dimensions (width, height and depth):
+方形设定由位置, 旋转和尺寸 (宽度, 高度和深度) 组成:
 
 ![Box shape](images/physics/box.png)
 
 ### Sphere shape
-A sphere has a position, rotation and diameter:
+圆形设定由位置, 旋转和直径组成:
 
 ![Sphere shape](images/physics/sphere.png)
 
 ### Capsule shape
-A capsule has a position, rotation, diameter and height:
+胶囊形设定由位置, 旋转, 直径和高度组成:
 
 ![Sphere shape](images/physics/capsule.png)
 
-### Tilemap collision shape
-Defold includes a feature allowing you to easily generate physics shapes for a tile map. The [Tilemap manual](/manuals/tilemap/) explains how to add collision groups to a tile source and assign tiles to collision groups ([example](/examples/tilemap/collisions/)).
+### 瓷砖地图碰撞形状
+Defold 包含一个功能就是从瓷砖地图中自动生成物理碰撞形状. [瓷砖地图教程](/manuals/tilemap/) 介绍了新建瓷砖图源的碰撞组与把瓷砖分配给碰撞组的 ([例子](/examples/tilemap/collisions/)).
 
-To add collision to a tile map:
+在瓷砖地图上添加碰撞:
 
-1. Add the tilemap to a game object by <kbd>right-clicking</kbd> the game object and selecting <kbd>Add Component File</kbd>. Select the tile map file.
-2. Add a collision object component to the game object by <kbd>right-clicking</kbd> the game object and selecting <kbd>Add Component ▸ Collision Object</kbd>.
-3. Instead of adding shapes to the component, set the *Collision Shape* property to the *tilemap* file.
-4. Set up the collision object component *Properties* as usual.
+1. <kbd>右键点击</kbd> 游戏对象, 选择 <kbd>Add Component File</kbd>. 来选取瓷砖地图文件.
+2. <kbd>右键点击</kbd> 游戏对象, 选择 <kbd>Add Component ▸ Collision Object</kbd> 加入碰撞对象组件.
+3. 不加入形状, 而是配置 *Collision Shape* 属性为 *瓷砖地图* 文件.
+4. 设置碰撞对象的其他 *属性*.
 
 ![Tilesource collision](images/physics/collision_tilemap.png){srcset="images/physics/[email protected] 2x"}
 
-::: important
-Note that the *Group* property is **not** used here since the collision groups are defined in the tile map's tile source.
+::: 注意
+这里的 *Group* 属性 **不** 生效, 因为碰撞组已在瓷砖图源中定义好了.
 :::
 
-### Convex hull shape
-Defold includes a feature allowing you to create a convex hull shape from three or more points. You can use an external tool such as the [Defold Polygon Editor](/assets/defoldpolygoneditor/) or the [Physics Body Editor](/assets/physicsbodyeditor/) to create a convex hull shape.
+### 凸多边形
+Defold 有一个功能就是让你用3个或多个点建立凸多边形. 可以使用资源 [Defold 多边形编辑器](/assets/defoldpolygoneditor/) 或者 [物理刚体编辑器](/assets/physicsbodyeditor/) 来创建凸多边形.
 
-1. Create convex hull shape file (file extension `.convexshape`) using an external editor.
-2. Instead of adding shapes to the collision object component, set the *Collision Shape* property to the *convex shape* file.
+1. 新建凸多边形文件 (扩展名 `.convexshape`).
+2. 不在碰撞对象上加入形状, 而是设置 *Collision Shape* 属性为 *凸多边形文件*.
 
-::: sidenote
-The shape will not be drawn in the editor. You can [enable Physics debugging](/manuals/debugging/#debugging-problems-with-physics) at runtime to see the shape.
+::: 注意
+编辑器里不显示形状. 只有 [开启物理调试](/manuals/debugging-game-logic/#物理引擎调试) 才能在运行时看到形状.
 :::
 
 
-### Scaling collision shapes
+### 缩放碰撞形状
 
-It is possible to let the collision object and its shapes inherit the scale of the game object. Check the [Allow Dynamic Transforms](/manuals/project-settings/#allow-dynamic-transforms) checkbox in the Physics section of *game.project* to enable this. Note that only uniform scaling is supported and that the smallest scale value will be used if the scale isn't uniform.
+可以让碰撞形状继承游戏对象的缩放. 在 *game.project* 里的物理部分勾选 [Allow Dynamic Transforms](/manuals/project-settings/#Allow Dynamic Transforms) 即可. 注意缩放继承只支持等比缩放, 如果不等比, 去三周最小值.
 
 
-### Rotating collision shapes
+### 旋转碰撞形状
 
-### Rotating collision shapes in 3D physics
-Collision shapes in 3D physics can be rotated around all axis.
+#### 在3D物理世界中旋转碰撞形状
+在3D物理中物体在各个轴上都可以进行旋转.
 
 
-### Rotating collision shapes in 2D physics
-Collision shapes in 2D physics can only be rotated around the z-axis. Rotation around the x or y axis will yield incorrect results and should be avoided, even when rotating 180 degrees to essentially flip the shape along the x or y axis. To flip a physics shape it is recommended to use [`physics.set_hlip(url, flip)`](/ref/stable/physics/?#physics.set_hflip:url-flip) and [`physics.set_vlip(url, flip)`](/ref/stable/physics/?#physics.set_vflip:url-flip).
+#### 在2D物理世界中旋转碰撞形状
+在3D物理中物体只能在z轴上旋转. 其他轴旋转会造成错误结果, 即使旋转180度用于翻转形状也不行. 要翻转物理形状推荐使用 [`physics.set_hlip(url, flip)`](/ref/stable/physics/?#physics.set_hflip:url-flip) 和 [`physics.set_vlip(url, flip)`](/ref/stable/physics/?#physics.set_vflip:url-flip) 函数.
 
 
-### Units used by the physics engine simulation
+### 物理引擎单位
 
-The physics engine simulates Newtonian physics and it is designed to work well with meters, kilograms and seconds (MKS) units. Furthermore, the physics engine is tuned to work well with moving objects of a size in the 0.1 to 10 meters range (static objects can be larger) and by default the engine treats 1 unit (pixel) as 1 meter. This conversion between pixels and meters is convenient on a simulation level, but from a game creation perspective it isn't very useful. With default settings a collision shape with a size of 200 pixels would be treated as having a size of 200 meters which is well outside of the recommended range, at least for a moving object. In general it is required that the physics simulation is scaled for it to work well with the typical size of objects in a game. The scale of the physics simulation can be changed in `game.project` via the [physics scale setting](/manuals/project-settings/#physics). Setting this value to for instance 0.02 would mean that 200 pixels would be treated as a 4 meters. Do note that the gravity (also changed in `game.project`) has to be increased to accommodate for the change in scale.
+设计上按照牛顿物理学单位米, 千克和秒 (MKS) 的标准单位. 模拟物尺寸 0.1 到 10 米范围 (静态对象可以更大) 效果较好, 默认一像素 (pixel) 当作 1 米. 这种转换是物理模拟器层次上的, 对游戏来说并不适用.
+默认一个200像素的物体在物理世界相当于200米超过了最佳模拟范围. 一般需要对游戏里的物体进行物理上的缩放. 可以在 `game.project` 里的 [物理缩放设置](/manuals/project-settings/#Physics) 处指定缩放值.
+比如设置为 0.02 意味着 1:50, 那么200像素就是 4 米. 注意重力 (也在 `game.project` 里进行设定) 也需要基于缩放值进行调整.
 
-## Group and mask
+## 碰撞组与碰撞掩码
 
-The physics engine allows you to group your physics objects and filter how they should collide. This is handled by named _collision groups_. For each collision object you create two properties control how the object collides with other objects, *Group* and *Mask*.
+物理引擎通过组与掩码处理碰撞. 这个组就是 _碰撞组_. 每个碰撞对象都有2个属性用以控制其与其他物体的碰撞, *Group* 和 *Mask*.
 
-For a collision between two objects to register both objects must mutually specify each other's groups in their *Mask* field.
+碰撞只发生在两个物体所处的组分别被包含在对方的 *碰撞掩码* 之中的情况下.
 
 ![Physics collision group](images/physics/collision_group.png){srcset="images/physics/[email protected] 2x"}
 
-The *Mask* field can contain multiple group names, allowing for complex interaction scenarios.
+*掩码* 可包含多个组名, 以实现复杂的碰撞控制.
 
 
-## Collision messages
+## 碰撞消息
 
-When two objects collide, the engine will broadcast messages to all components in both objects:
+两个物体发生碰撞时, 消息会广播到两个物体上的所有组件中:
 
 **`"collision_response"`**
 
-This message is sent for all collision objects. It has the following fields set:
+碰撞对象会收到此消息. 其包含以下数据内容:
 
 `other_id`
-: the id of the instance the collision object collided with (`hash`)
+: 另一个碰撞物的id (`hash`过的)
 
 `other_position`
-: the world position of the instance the collision object collided with (`vector3`)
+: 另一个碰撞物的世界坐标 (`vector3`类型)
 
 `other_group`
-: the collision group of the other collision object (`hash`)
+: 另一个碰撞物所在的碰撞组 (`hash`过的)
 
-The collision_response message is only adequate to resolve collisions where you don't need any details on the actual intersection of the objects, for example if you want to detect if a bullet hits an enemy. There is only one of these messages sent for any colliding pair of objects each frame.
+如果不需要很详细的信息, 碰撞响应消息就足够了, 比如检测子弹是否碰撞了敌人. 每帧每对碰撞物只有一个能收到此消息.
 
 **`"contact_point_response"`**
 
-This message is sent when one of the colliding objects is dynamic or kinematic. It has the following fields set:
+这个消息由 dynamic 或 kinematic 碰撞对物体其中之一接收. 附带如下数据:
 
 `position`
-: world position of the contact point (`vector3`).
+: 接触点世界坐标 (`vector3`类型).
 
 `normal`
-: normal in world space of the contact point, which points from the other object towards the current object (`vector3`).
+: 接触点世界坐标系法向量, 方向是从另一物体指向当前物体 (`vector3`类型).
 
 `relative_velocity`
-: the relative velocity of the collision object as observed from the other object (`vector3`).
+: 两个接触物体之间的相对速度, 方向是从另一物体指向当前物体 (`vector3`类型).
 
 `distance`
-: the penetration distance between the objects -- non negative (`number`).
+: 两个接触物体之间穿透距离 -- 非负数 (`number`类型).
 
 `applied_impulse`
-: the impulse the contact resulted in (`number`).
+: 两个接触物体间的冲量大小 (`number`类型).
 
 `life_time`
-: (*not currently used!*) life time of the contact (`number`).
+: (*目前未使用*) 接触时长 (`number`类型).
 
 `mass`
-: the mass of the current collision object in kg (`number`).
+: 当前物体质量, 单位千克 (`number`类型).
 
 `other_mass`
-: the mass of the other collision object in kg (`number`).
+: 另一个物体质量, 单位千克 (`number`类型).
 
 `other_id`
-: the id of the instance the collision object is in contact with (`hash`).
+: 另一个物体的id (`hash`过的).
 
 `other_position`
-: the world position of the other collision object (`vector3`).
+: 另一个物体的世界坐标 (`vector3`类型).
 
 `group`
-: the collision group of the other collision object (`hash`).
+: 另一个物体所处的碰撞组 (`hash`过的).
 
-For a game or application where you need to separate objects perfectly, the `"contact_point_response"` message gives you all information you need. However, note that for any given collision pair, several `"contact_point_response"` messages can be received each frame, depending on the nature of the collision. See below for more information.
+要让相碰撞的物体好好分离, 用 `"contact_point_response"` 消息里的数据就够了. 注意每帧每对碰撞物可能不止收到一个 `"contact_point_response"` 消息, 取决于接触的多少. 详情请见下文.
 
-## Trigger messages
+## 触发器消息
 
-Triggers are light weight collision objects. Thay are similar to ray casts in that they read the physics world as opposed to interacting with it.
+触发器是精简版的碰撞物体. 根投射射线类似, 它们迭代物理世界物品但不与之进行交互.
 
-In a trigger collision `"collision_response"` messages are sent. In addition, triggers also send a special `"trigger_response"` message when the collision begins and ends. The message has the following fields:
+触发器碰撞时发出 `"collision_response"` 消息. 而且在碰撞开始和结束时都会发送 `"trigger_response"` 消息. 消息包含如下信息:
 
 `other_id`
-: the id of the instance the collision object collided with (`hash`).
+: 另一个物体的id (`hash`过的).
 
 `enter`
-: `true` if the interaction was an entry into the trigger, `false` if it was an exit. (`boolean`).
+: 如果另一个物体进入触发器为 `true`, 离开为 `false`. (`boolean`类型).
 
-## Resolving kinematic collisions
+## 动画碰撞对象
 
-Using kinematic collision objects require you to resolve collisions yourself and move the objects as a reaction. A naive implementation of separating two colliding objects looks like this:
+对于动画碰撞对象的碰撞必须手动处理. 一个想当然的处理方法如下:
 
 ```lua
 function on_message(self, message_id, message, sender)
-  -- Handle collision
+  -- 处理碰撞
   if message_id == hash("contact_point_response") then
     local newpos = go.get_position() + message.normal * message.distance
     go.set_position(newpos)
@@ -245,68 +247,68 @@ function on_message(self, message_id, message, sender)
 end
 ```
 
-This code will separate your kinematic object from other physics object it penetrates, but the separation often overshoots and you will see jitter in many cases. To understand the problem better, consider the following case where a player character has collided with two objects, *A* and *B*:
+动画碰撞对象的确离开了碰撞穿透, 但是分离之后经常会过冲, 这在许多情况下会产生抖动. 为了便于理解, 想象游戏主角碰到了两个物体, *A* 和 *B*:
 
 ![Physics collision](images/physics/collision_multi.png){srcset="images/physics/[email protected] 2x"}
 
-The physics engine will send multiple `"contact_point_response"` message, one for object *A* and one for object *B* the frame the collision occurs. If you move the character in response to each penetration, as in the naive code above, the resulting separation would be:
+碰撞发生的那一帧里, 物理引擎发出多个 `"contact_point_response"` 消息, 一个给 *A* 一个给 *B*. 如果按上面那样移动角色, 结果会是这样:
 
-- Move the character out of object *A* according to its penetration distance (the black arrow)
-- Move the character out of object *B* according to its penetration distance (the black arrow)
+- 根据 *A* 的穿透距离把角色向上移 (黑色箭头)
+- 根据 *B* 的穿透距离把角色向左上移 (黑色箭头)
 
-The order of these is arbitrary but the result is the same either way: a total separation that is the *sum of the individual penetration vectors*:
+顺序无所谓结果是一样的: 最终位移是 *每个穿透向量的矢量和*:
 
 ![Physics separation naive](images/physics/separation_naive.png){srcset="images/physics/[email protected] 2x"}
 
-To properly separate the character from objects *A* and *B*, you need to handle each contact point's penetration distance and check if any previous separations have already, wholly or partially, solved the separation.
+要想正确地将角色移出 *A* 和 *B*, 需要处理碰撞点的穿透距离并检测上一个位移是否, 完全或部分, 分离了它们.
 
-Suppose that the first contact point message comes from object *A* and that you move the character out by *A*'s penetration vector:
+假设第一次碰撞从 *A* 开始, 然后针对 *A* 做位移:
 
 ![Physics separation step 1](images/physics/separation_step1.png){srcset="images/physics/[email protected] 2x"}
 
-Then the character has already been partially separated from *B*. The final compensation necessary to perform full separation from object *B* is indicated by the black arrow above. The length of the compensation vector can be calculated by projecting the penetration vector of *A* onto the penetration vector of *B*:
+这样一来角色也部分离开了 *B*. 最后只剩下 *B* 黑色箭头那点穿透. 这段位移应该是 *A* 向量映射到 *B* 剩余的补偿:
 
 ![Projection](images/physics/projection.png){srcset="images/physics/[email protected] 2x"}
 
 $$l = vmath.project(A, B) \times vmath.length(B)$$
 
-The compensation vector can be found by reducing the length of *B* by *l*. To calculate this for an arbitrary number of penetrations, you can accumulate the necessary correction in a vector by, for each contact point, and starting with a zero length correction vector:
+补偿向量等于 *B* 向量减去 *l* 向量. 所以计算位移的时候, 对于每个碰撞点, 可以引入矫正向量按以下步骤进行矫正:
 
-1. Project the current correction against the contact's penetration vector.
-2. Calculate what compensation is left from the penetration vector (as per the formula above).
-3. Move the object by the compensation vector.
-4. Add the compensation to the accumulated correction.
+1. 把当前矫正向量映射到碰撞穿透向量上.
+2. 计算穿透向量的补偿 (按照上述公式).
+3. 依照补偿向量移动对象.
+4. 把补偿向量累加到矫正向量中.
 
-A complete implementation looks like this:
+完整的代码实现如下:
 
 ```lua
 function init(self)
-  -- correction vector
+  -- 校正向量
   self.correction = vmath.vector3()
 end
 
 function update(self, dt)
-  -- reset correction
+  -- 重置矫正向量
   self.correction = vmath.vector3()
 end
 
 function on_message(self, message_id, message, sender)
-  -- Handle collision
+  -- 处理碰撞
   if message_id == hash("contact_point_response") then
-    -- Get the info needed to move out of collision. We might
-    -- get several contact points back and have to calculate
-    -- how to move out of all of them by accumulating a
-    -- correction vector for this frame:
+    -- 获取位移计算所需数据. 
+    -- 当前帧可能有多个碰撞点需要处理,
+    -- 通过累积矫正向量,
+    -- 达到正确计算位移的目的:
     if message.distance > 0 then
-      -- First, project the accumulated correction onto
-      -- the penetration vector
+      -- 第一步, 把矫正向量投射到
+      -- 穿透向量上.
       local proj = vmath.project(self.correction, message.normal * message.distance)
       if proj < 1 then
-        -- Only care for projections that does not overshoot.
+        -- 没有过冲的才需要补偿.
         local comp = (message.distance - message.distance * proj) * message.normal
-        -- Apply compensation
+        -- 应用补偿向量.
         go.set_position(go.get_position() + comp)
-        -- Accumulate correction done
+        -- 积累矫正向量.
         self.correction = self.correction + comp
       end
     end
@@ -314,87 +316,88 @@ function on_message(self, message_id, message, sender)
 end
 ```
 
-## Ray casts
+## 射线投射
 
-Ray casts are used to read the physics world along a linear ray. To cast a ray into the physics world, you provide a start and end position as well as a set of collision groups to test against.
+射线用于收集延一条投射射线所遇到的物理世界的物体. 只要提供起止点和碰撞组, 就可以投射射线了.
 
-If the ray hits a physics object you will get information about the object it hit. Rays intersect with dynamic, kinematic and static objects. They do not interact with triggers.
+射线碰到的物体数据都会被记录下来. 包括动态, 静态和动画碰撞对象. 不包括触发器对象.
 
 ```lua
 function update(self, dt)
-  -- request ray cast
+  -- 投射射线
   local my_start = vmath.vector3(0, 0, 0)
   local my_end = vmath.vector3(100, 1000, 1000)
   local my_groups = { hash("my_group1"), hash("my_group2") }
 
   local result = physics.raycast(my_start, my_end, my_groups)
   if result then
-      -- act on the hit (see 'ray_cast_response' message for all values)
+      -- 处理射线碰撞结果 (所有数据参见 'ray_cast_response' 消息)
       print(result.id)
   end
 end
 ```
 
-::: sidenote
-Ray casts will ignore collision objects that contain the starting point of the ray. This is a limitation in Box2D.
+::: 注意
+结果不包括射线起始点位置的碰撞物体. 这是 Box2D 做的限制.
 :::
 
-## Joints
+## 关节
 
-Defold supports joints for 2D physics. A joint connects two collision objects using some kind of constraint. The supported joint types are:
+Defold 支持物理关节. 一个关键基于某种限制连接两个物体. 支持的关节类型如下:
 
-* Fixed (physics.JOINT_TYPE_FIXED) - A rope joint that restricts the maximum distance between two points. In Box2D referred to as a Rope joint.
-* Hinge (physics.JOINT_TYPE_HINGE) - A hinge joint specifies an anchor point on two collision objects and moves them so that the two collision objects are always in the same place, and the relative rotation of the collision objects is not restricted. The hinge joint can enable a motor with a defined maximum engine torque and speed. In Box2D referred to as a Revolute joint.
-* Spring (physics.JOINT_TYPE_SPRING) - A spring joint keeps two collision objects at a constant distance from each other. The spring joint can be made soft like a spring with a frequency and damping ratio. In Box2D referred to as a Distance joint.
-* Slider (physics.JOINT_TYPE_SLIDER) - A slider joint allows for relative translation of two collision objects along a specified axis and prevents relative rotation. In Box2D referred to as a Prismatic joint.
+* Fixed (physics.JOINT_TYPE_FIXED) - 限制两物体最大距离的固定关节. 在 Box2D 被称为绳子关节.
+* Hinge (physics.JOINT_TYPE_HINGE) - 把两个物体通过一个锚点钉在一起的钉子关节. 两物体相对位置固定而相对旋转没有限制. 这种关节可以开启马达给一个最大扭力与速度. 在 Box2D 被称为旋转关节.
+* Spring (physics.JOINT_TYPE_SPRING) - 限制两个物体之间距离范围的弹簧关节. 弹簧关节通过设定其频率和阻尼比可以让物体像是被软弹簧连接. 在 Box2D 被称为距离关节.
+* Slider (physics.JOINT_TYPE_SLIDER) - 限制两物体只能在某个指定轴上相对移动而不允许相对转动的滑动关节. 在 Box2D 被称为活塞关节.
 
-### Creating joints
+### 建立关节
 
-Joints can currently only be created programmatically using [`physics.create_joint()`](/ref/physics/#physics.create_joint:joint_type-collisionobject_a-joint_id-position_a-collisionobject_b-position_b-[properties]):
-::: sidenote
-Editor support for creating joints is planned but no release date has been decided.
+目前只能使用 [`physics.create_joint()`](/ref/physics/#physics.create_joint:joint_type-collisionobject_a-joint_id-position_a-collisionobject_b-position_b-[properties]) 函数手动建立关节:
+
+::: 注意
+编辑器可是环境新建关节在支持计划中但发布时间未知.
 :::
 
 ```lua
--- connect two collision objects with a fixed joint constraint (rope)
+-- 将两个碰撞物体用固定关节连接 (绳子)
 physics.create_joint(physics.JOINT_TYPE_FIXED, "obj_a#collisionobject", "my_test_joint", vmath.vector3(10, 0, 0), "obj_b#collisionobject", vmath.vector3(0, 20, 0), { max_length = 20 })
 ```
 
-The above will create a fixed joint with id `my_test_joint` connected between the two collision object `obj_a#collisionobject` and `obj_b#collisionobject`. The joint is connected 10 pixels to the left of the center of collision object `obj_a#collisionobject` and 20 pixels above the center of collision object `obj_b#collisionobject`. The maximum length of the joint is 20 pixels.
+上述代码创建了一个固定关节, 其id为 `my_test_joint`, 连接了两个物体 `obj_a#collisionobject` 与 `obj_b#collisionobject`. 关节位于 `obj_a#collisionobject` 偏左10像素, `obj_b#collisionobject` 偏上20像素的位置上. 设定的最大距离是20像素.
 
-### Destroying joints
+### 删除关节
 
-A joint can be destroyed using [`physics.destroy_joint()`](/ref/physics/#physics.destroy_joint:collisionobject-joint_id):
+可以使用 [`physics.destroy_joint()`](/ref/physics/#physics.destroy_joint:collisionobject-joint_id) 函数删除关节:
 
 ```lua
--- destroy a joint previously connected to the first collision object
+-- 删除上面提到的第一个物体上的关节
 physics.destroy_joint("obj_a#collisionobject", "my_test_joint")
 ```
 
-### Reading from and Updating joints
+### 关节属性及修改
 
-The properties of a joint can be read using [`physics.get_joint_properties()`](/ref/physics/#physics.get_joint_properties:collisionobject-joint_id) and set using [`physics.set_joint_properties()`](/ref/physics/#physics.set_joint_properties:collisionobject-joint_id-properties):
+可以使用 [`physics.get_joint_properties()`](/ref/physics/#physics.get_joint_properties:collisionobject-joint_id) 读取关节属性, 使用 [`physics.set_joint_properties()`](/ref/physics/#physics.set_joint_properties:collisionobject-joint_id-properties) 修改关节属性:
 
 ```lua
 function update(self, dt)
     if self.accelerating then
         local hinge_props = physics.get_joint_properties("obj_a#collisionobject", "my_hinge")
-        -- increase motor speed by 100 revolutions per second
+        -- 马达速度提升每秒100转
         hinge_props.motor_speed = hinge_props.motor_speed + 100 * 2 * math.pi * dt
         physics.set_joint_properties("obj_a#collisionobject", "my_hinge", hinge_props)
     end
 end
 ```
 
-### Get joint reaction force and torque
+### 关节反作用力和扭矩
 
-The reaction force and torque applied to a joint can be read using [`physics.get_joint_reaction_force()`](/ref/physics/#physics.get_joint_reaction_force:collisionobject-joint_id) and [`physics.get_joint_reaction_torque()`](/ref/physics/#physics.get_joint_reaction_torque:collisionobject-joint_id).
+可以使用 [`physics.get_joint_reaction_force()`](/ref/physics/#physics.get_joint_reaction_force:collisionobject-joint_id) 读取关节反作用力, 使用 [`physics.get_joint_reaction_torque()`](/ref/physics/#physics.get_joint_reaction_torque:collisionobject-joint_id) 读取关节扭力.
 
 
-## Caveats and common issues
+## 注意事项
 
-Collection proxies
-: Through collection proxies it is possible to load more than one top level collection, or *game world* into the engine. When doing so it is important to know that each top level collection is a separate physical world. Physics interactions (collisions, triggers, ray-casts) only happen between objects belonging to the same world. So even if the collision objects from two worlds visually sits right on top of each other, there cannot be any physics interaction between them.
+碰撞代理
+: 通过碰撞代理可以支持多个物理集合, 或称 *游戏世界*. 但是要记住每个集合都是一个单独的物理世界. 物理现象 (碰撞, 触发, 射线) 之发生在同一世界中. 两个不同集合的物体就算放到一块儿, 也不会发生物理碰撞.
 
-Collisions not detected
-: If you have problems with collisions not being handled or detected properly then make sure to read up on [physics debugging in the Debugging manual](/manuals/debugging/#debugging-problems-with-physics).
+碰撞漏检
+: 如果发现碰撞未检测或未处理请先阅读 [调试教程的物理调试部分](/manuals/debugging-game-logic/#物理引擎调试).

+ 5 - 5
docs/zh/manuals/project-settings.md

@@ -94,12 +94,12 @@ $ adb shell cat /mnt/sdcard/Android/data/com.defold.dmengine/files/log.txt
 垂直同步, 根据硬件的帧率进行刷新. 可以被驱动程序或者操作系统平台设置覆盖.
 
 #### Display Profiles
-指定使用哪个显示样式文件, 默认 `/builtins/render/default.display_profilesc`.  详情请见 [GUI 排版教程](/manuals/gui-layouts/#creating-display-profiles).
+指定使用哪个显示样式文件, 默认 `/builtins/render/default.display_profilesc`.  详情请见 [GUI 排版教程](/manuals/gui-layouts/#新建显示档案).
 
 #### Dynamic Orientation
 开启的话会在设备转动时动态切换横竖显示方向. 注意开发用app(指dmengine)不参考此设置.
 
-## 渲染
+## Render
 
 #### Clear Color Red
 清除红色通道, 建立游戏窗口和渲染脚本中使用. 1.2.167 版新增.
@@ -307,7 +307,7 @@ label 最大数目, 默认是 `64`.
 用于应用图标的图片 (.png) 文件, 宽高分辨率表示为 `W` &times; `H`.
 
 #### Launch Screen
-Storyboard 文件 (.storyboard). 其创建方法详情请见 [iOS 教程](/manuals/ios/#creating-a-storyboard).
+Storyboard 文件 (.storyboard). 其创建方法详情请见 [iOS 教程](/manuals/ios/#创建 storyboard).
 
 #### Launch Image 320x480--2436x1125
 用于应用启动图的图片 (.png) 文件, 宽高分辨率表示为 `W` &times; `H`. iOS 基于启动图选择分辨率.
@@ -368,7 +368,7 @@ Google Cloud Messaging Sender Id. 此值由 Google 签发, 设置后才能开启
 #### Debuggable
 指定应用是否可以使用诸如 [GAPID](https://github.com/google/gapid) 或者 [Android Studio](https://developer.android.com/studio/profile/android-profiler) 之类的工具来调试. 这将开启 Android manifest 的 `android:debuggable` 选项.
 
-## MacOS / OS X
+## MacOS  OS X
 
 #### App Icon
 用于MacOS应用图标的图片 (.png) 文件.
@@ -490,7 +490,7 @@ local my_value = tonumber(sys.get_config("test.my_value"))
 
 交换间隔是指在垂直空白期 (v-blank) 同步中交换前后缓冲的间隔, 是屏幕图片从前缓冲更新数据的硬件事件. 取值为1就是每个v-blank做一次交换缓冲, 取值为2就是每两个(每隔一个)v-blank做一次交换缓冲, 以此类推. 取值为0则做交换缓冲时不等待v-blank时间\*. 调用 [```set_vsync_swap_interval```](/ref/sys/#sys.set_vsync_swap_interval:swap_interval) 方法可以设置 `swap_interval` 的值.
 
-### 警告
+### 注意事项
 目前, Defold 在初始化时查询屏幕刷新率并且把它作为固定 `dt` 的依据. 如果你需要支持可变刷新率 (比如 GSync 或者 FreeSync) 或者其他刷新率不是很有参考性的情况下, 关闭 `Vsync`来使引擎测量每帧实际 `dt` 而不是固定dt.
 
 

+ 2 - 2
docs/zh/manuals/render.md

@@ -5,7 +5,7 @@ brief: 本教程介绍了 Defold 的渲染流程及其编程方法.
 
 # 渲染
 
-引擎在屏幕上显示的每个对象:精灵,模型,图块,粒子或GUI节点均由渲染器绘制。渲染器的核心是控制渲染流程的渲染脚本。默认情况下,每个2D均使用指定混合和正确Z深度来进行绘制-因此,除了顺序和简单混合之外您可能不需要了解渲染。对于大多数2D游戏,默认流程功能良好,但是您的游戏可能有特殊要求。在这种情况下,Defold允许您编写量身定制的渲染程序。
+引擎在屏幕上显示的每个对象:精灵,模型,图块,粒子或GUI节点均由渲染器绘制.渲染器的核心是控制渲染流程的渲染脚本.默认情况下,每个2D均使用指定混合和正确Z深度来进行绘制-因此,除了顺序和简单混合之外您可能不需要了解渲染.对于大多数2D游戏,默认流程功能良好,但是您的游戏可能有特殊要求.在这种情况下,Defold允许您编写量身定制的渲染程序.
 
 ### 渲染管线是什么东东?
 
@@ -92,7 +92,7 @@ msg.post("@render:", "use_stretch_projection", { near = -1, far = 1 })
 msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })
 ```
 
-### fixed
+### Fixed
 
 以一个固定倍数按比例缩放视口. 也就是说倍数不是 100% 的话就会自行多显示或少显示内容, 而不按照 "game.project" 的设定分辨率渲染:
 

+ 71 - 71
docs/zh/manuals/shader.md

@@ -5,109 +5,109 @@ brief: 本教程介绍了顶点和片元着色器及其在 Defold 中的使用
 
 # Shaders
 
-Shader programs are at the core of graphics rendering. They are programs written in a C-like language called GLSL (GL Shading Language) that the graphics hardware run to perform operations on either the underlying 3D data (the vertices) or the pixels that end up on the screen (the "fragments"). Shaders are used for drawing sprites, lighting 3D models, creating full screen post effects and much, much more.
+着色程序是图像渲染的核心. 由类似 C 语言的 GLSL (GL 着色语言) 语言编写而成供图形设备和操作系统操作 3D 数据 (称为顶点) 和屏幕上的像素 (称为片元). 着色器可以用来渲染图像, 3D 模型, 灯光和全屏的后期特效等等等等.
 
-This manual describes how Defold's rendering pipeline interfaces with vertex and fragment shaders. In order to create shaders for your content, you also need to understand the concept of materials, as well as how the render pipeline works.
+本教程介绍了 Defold 的渲染管线中的顶点/片元着色器接口. 为了编写着色器, 你还需要理解材质的概念, 以及渲染管线工作原理.
 
-* See the [Render manual](/manuals/render) for details on the render pipeline.
-* See the [Material manual](/manuals/material) for details on materials.
+* 关于渲染管线详情请见 [渲染教程](/manuals/render).
+* 关于材质详情请见 [材质教程](/manuals/material).
 
-Specifications of OpenGL ES 2.0 (OpenGL for Embedded Systems) and OpenGL ES Shading Language can be found at https://www.khronos.org/registry/gles/
+OpenGL ES 2.0 (OpenGL for Embedded Systems) 和 OpenGL ES 着色语言官方说明请见 https://www.khronos.org/registry/gles/
 
-Observe that on desktop computers it is possible to write shaders using features not available on OpenGL ES 2.0. Your graphics card driver may happily compile and run shader code that will not work on mobile devices.
+注意桌面设备渲染功能大于 OpenGL ES 2.0. 电脑显卡支持的效果在移动设备上可能无法使用.
 
 
-## Concepts
+## 概念
 
 Vertex shader
-: A vertex shader cannot create or delete vertices, only change the position of a vertex. Vertex shaders are commonly used to transform the positions of vertices from the 3D world space into 2D screen space.
+: 顶点着色器不新建也不删除顶点, 只是计算顶点的位置. 顶点着色器一般用于把3D空间的顶点位置转换到2D屏幕空间之中.
 
-  The input of a vertex shader is vertex data (in the form of `attributes`) and constants (`uniforms`). Common constants are the matrices necessary to transform and project the position of a vertex to screen space.
+  输入的是顶点数据 (以 `attributes` 的形式) 和常量 (`uniforms`). 通常常量是用于位置转换计算的矩阵.
 
-  The output of the vertex shader is the computed screen position of the vertex (`gl_Position`). It is also possible to pass data from the vertex shader to the fragment shader through `varying` variables.
+  输出的是屏幕空间顶点坐标 (`gl_Position`). 也可以通过 `varying` 变量向片元着色器传递数据.
 
 Fragment shader
-: After the vertex shader is done, it is the job of the fragment shader to decide the coloring of each fragment (or pixel) of the resulting primitives.
+: 顶点处理结束后, 由片元着色器来接手处理每个片元 (像素) 的颜色数据.
 
-  The input of a fragment shader is constants (`uniforms`) as well as any `varying` variables that has been set by the verter shader.
+  输入的是常量 (`uniforms`) 还有从顶点着色器发来的 `varying` 变量.
 
-  The output of the fragment shader is the color value for the particular fragment (`gl_FragColor`).
+  输出的是单个片元的颜色 (`gl_FragColor`).
 
 World matrix
-: The vertex positions of a model's shape are stored relative to the model's origin. This is called "model space". The game world, however, is a "world space" where the position, orientation and scale of each vertex is expressed relative to the world origin. By keeping these separate the game engine is able to move, rotate and scale each model without destroying the original vertex values stored in the model component.
+: 模型顶点的位置基于模型原点. 这被称作 "模型空间". 而游戏使用的是 "世界空间" 也就是每个点的位置旋转和缩放都是基于世界坐标系原点的. 把两者区别开便于引擎实现导入模型的移动, 旋转和缩放而不会破坏模型组件里存储的顶点数据.
 
-  When a model is placed in the game world the model's local vertex coordinates must be translated to world coordinates. This translation is done by a *world transform matrix*, which tells what  translation (movement), rotation and scale should be applied to a model's vertices to be correctly placed in the game world's coordinate system.
+  把模型放置于游戏世界时, 模型顶点要改成基于世界坐标系的. 这就需要一个 *世界变换矩阵* 来确定多少移动, 旋转和缩放应该应用于模型顶点以修正其基于世界坐标系的位置.
 
   ![World transform](images/shader/world_transform.png){srcset="images/shader/[email protected] 2x"}
 
-View and projection matrix
-: In order to put the vertices of the game world onto the screen, each matrix' 3D coordinates is first translated into coordinates relative to the camera. This is done with a _view matrix_. Secondly, the vertices are projected onto the 2D screen space with a _projection matrix_:
+View  projection matrix
+: 为了把游戏世界物体投射到屏幕上, 每个矩阵的3D坐标先是转换为基于摄像机的坐标. 这时使用的是 _视口矩阵_. 然后, 顶点再被转换为屏幕空间坐标, 这时使用的是 _投射矩阵_:
 
   ![Projection](images/shader/projection.png){srcset="images/shader/[email protected] 2x"}
 
 Attributes
-: A value associated with an individual vertex. Attributes are passed to the shader by the engine and if you want to access an attribute you just declare it in your shader program. Different component types have a different set of attributes:
-  - Sprite has `position` and `texcoord0`.
-  - Tilegrid has `position` and `texcoord0`.
-  - Spine model has `position` and `texcoord0`.
-  - GUI node has `position`, `textcoord0` and `color`.
-  - ParticleFX has `position`, `texcoord0` and `color`.
-  - Model has `position`, `texcoord0` and `normal`.
-  - Font has `position`, `texcoord0`, `face_color`, `outline_color` and `shadow_color`.
+: 顶点上的相关属性. 属性经由引擎传送给着色器. 只要在着色程序中声明一下即可使用. 不同类型组件有不同的属性:
+  - Sprite 有 `position` 和 `texcoord0`.
+  - Tilegrid 有 `position` 和 `texcoord0`.
+  - Spine model 有 `position` 和 `texcoord0`.
+  - GUI node 有 `position`, `textcoord0` 和 `color`.
+  - ParticleFX 有 `position`, `texcoord0` 和 `color`.
+  - Model 有 `position`, `texcoord0` 和 `normal`.
+  - Font 有 `position`, `texcoord0`, `face_color`, `outline_color` 和 `shadow_color`.
 
 Constants
-: Shader constants remain constant for the duration of the render draw call. Constants are added to the material file *Constants* sections and then declared as `uniform` in the shader program. Sampler uniforms are added to the *Samplers* section of the material and then declared as `uniform` in the shader program. The matrices necessary to perform vertex transformations in a vertex shader are available as constants:
+: 着色器常量保持在渲染器的一个 draw call 之内. 常量位于材质的 *Constants* 部分并且在着色器程序里声明为 `uniform`. 取样器位于材质的 *Samplers* 部分并且在着色程序里声明为 `uniform`. 在顶点着色器里作为常量提供矩阵是执行顶点转换所必需的:
 
-  - `CONSTANT_TYPE_WORLD` is the *world matrix* that maps from an object’s local coordinate space into world space.
-  - `CONSTANT_TYPE_VIEW` is the *view matrix* that maps from world space to camera space.
-  - `CONSTANT_TYPE_PROJECTION` is the *projection matrix* that maps from camera to screen space.
-  - Pre multiplied $world * view$, $view * projection$ and $world * view$ matrices are also available.
-  - `CONSTANT_TYPE_USER` is a `vec4` type constant that you can use as you wish.
+  - `CONSTANT_TYPE_WORLD` 是 *world matrix* 用于把物体本地空间坐标映射到世界坐标系中.
+  - `CONSTANT_TYPE_VIEW` 是 *view matrix* 用于世界空间到摄像机空间的映射.
+  - `CONSTANT_TYPE_PROJECTION` 是 *projection matrix* 用于摄像机空间到屏幕空间的映射.
+  -  还有预乘的 $world * view$, $view * projection$ 和 $world * view$ 矩阵都可使用.
+  - `CONSTANT_TYPE_USER` 是 `vec4` 可以自由使用的四元组.
 
-  The [Material manual](/manuals/material) explains how to specify constants.
+  关于着色器常量的用法详情请见 [材质教程](/manuals/material).
 
 Samplers
-: Shaders can declare *sampler* type uniform variables. Samplers are used to read values from an image source:
+: 着色器可以声明 *采样器* 类型 uniform 变量. 采样器用于从图片中读取数值:
 
-  - `sampler2D` samples from a 2D image texture.
-  - `samplerCube` samples from a 6 image cubemap texture.
+  - `sampler2D` 从2D纹理中采样.
+  - `samplerCube` 从六图 cubemap 纹理中采样.
 
-  You can use a sampler only in the GLSL standard library's texture lookup functions. The [Material manual](/manuals/material) explains how to specify sampler settings.
+  只能在 GLSL 标准库的纹理查找函数里使用采样器. 关于采样器设置详情请见 [材质教程](/manuals/material).
 
-UV coordinates
-: A 2D coordinate is associated with a vertex and it maps to a point on a 2D texture. A portion, or the whole, of the texture can therefore be painted onto the shape described by a set of vertices.
+UV 坐标
+: 2D纹理上的坐标. 用于将纹理对应到顶点组成的模型上.
 
   ![UV coordinates](images/shader/uv_map.png){srcset="images/shader/[email protected] 2x"}
 
-  A UV-map is typically generated in the 3D modelling program and stored in the mesh. The texture coordinates for each vertex are provided to the vertex shader as an attribute. A varying variable is then used to find the UV coordinate for each fragment as interpolated from the vertex values.
+  UV图由3D建模软件生成并且存储在网格之中. 每个顶点的纹理坐标作为属性提供给顶点着色器. 然后用 varying 变量来给从顶点数据插值产生的片元顶点查找UV坐标.
 
-Varying variables
-: Varying types of variables are used to pass information between the vertex stage and the fragment stage.
+Varying 变量
+: Varying 变量被用作从顶点到片元程序的数据传递媒介.
 
-  1. A varying variable is set in the vertex shader for each vertex.
-  2. During rasterization this value is interpolated for each fragment on the primitive being rendered. The distance of the fragment to the shape's vertices dictates the interpolated value.
-  3. The variable is set for each call to the fragment shader and can be used for fragment calculations.
+  1. varying 由顶点着色器为每个顶点所设立.
+  2. 在栅格化期间, 将为被渲染物每个片元间内插该值. 插值取决于片元到顶点间的距离.
+  3. 此变量在每次调用片元着色器时被设置传递可以用来进行片元着色计算.
 
   ![Varying interpolation](images/shader/varying_vertex.png){srcset="images/shader/[email protected] 2x"}
 
-  For instance, setting a varying to a `vec3` RGB color value on each corners of a triangle will interpolate the colors across the whole shape. Similarly, setting texture map lookup coordinates (or *UV-coordinates*) on each vertex in a rectangle allows the fragment shader to look up texture color values for the whole area of the shape.
+  比如说设定 varying 为三角面的顶点赋予 `vec3` RGB 颜色, 那么这个面上的片元都会根据此变量进行插值. 类似地, 设置四顶点平面的纹理采样坐标 (或称 *UV坐标*) 就可以让片元着色器查找到整个平面各个片元的颜色.
 
   ![Varying interpolation](images/shader/varying.png){srcset="images/shader/[email protected] 2x"}
 
 
-## The rendering process
+## 渲染过程
 
-Before ending up on the screen, the data that you create for your game goes through a series of steps:
+数据被投入屏幕之前, 要经过一系列步骤:
 
 ![Render pipeline](images/shader/pipeline.png){srcset="images/shader/[email protected] 2x"}
 
-All visual components (sprites, GUI nodes, particle effects or models) consists of vertices, points in 3D world that describe the shape of the component. The good thing by this is that it is possible to view the shape from any angle and distance. The job of the vertex shader program is to take a single vertex and translate it into a position in the viewport so the shape can end up on screen. For a shape with 4 vertices, the vertex shader program runs 4 times, each in parallell.
+可视组件 (sprite, GUI 节点, 粒子特效和模型) 都由顶点构成, 位于3D坐标系的顶点描述了组件的形状. 好处是从任何角度任何距离都可以观察这些组件. 顶点着色器的工作就是获取每个顶点并把它转换成视口坐标系的坐标以便投射到屏幕上. 对于一个四顶点形状来说, 顶点着色器要并行运行四次.
 
 ![vertex shader](images/shader/vertex_shader.png){srcset="images/shader/[email protected] 2x"}
 
-The input of the program is the vertex position (and other attribute data associated with the vertex) and the output is a new vertex position (`gl_Position`) as well as any `varying` variables that should be interpolated for each fragment.
+顶点着色程序输入的是顶点位置 (及顶点属性数据) 而输出的是一个新的顶点坐标 (`gl_Position`) 连同片元间插值的 `varying` 变量.
 
-The most simple vertex shader program just sets the position of the output to a zero vertex (which is not very useful):
+最简单的顶点着色程序大概就是全部输出为0坐标 (没啥用):
 
 ```glsl
 void main()
@@ -116,7 +116,7 @@ void main()
 }
 ```
 
-A more complete example is the built in sprite vertex shader:
+复杂点的像sprite的顶点着色程序:
 
 ```glsl
 -- sprite.vp
@@ -133,22 +133,22 @@ void main()
   var_texcoord0 = texcoord0;                            // [5]
 }
 ```
-1. A uniform (constant) containing the view and projection matrices multiplied.
-2. Attributes for the sprite vertex. `position` is already transformed into world space. `texcoord0` contains the UV coordinate for the vertex.
-3. Declare a varying output variable. This variable will be interpolated for each fragment between the values set for each vertex and sent to the fragment shader.
-4. `gl_Position` is set to the output position of the current vertex in projection space. This value has 4 components: `x`, `y`, `z` and `w`. The `w` component is used to calculate perspective-correct interpolation. This value is normally 1.0 for each vertex before any transformation matrix is applied.
-5. Set the varying UV coordinate for this vertex position. After rasterization it will be interpolated for each fragment and sent to the fragment shader.
+1. 一个 uniform (常量) 包含视口和投射预乘矩阵.
+2. 顶点属性. `position` 已被转换为世界坐标. `texcoord0` 包含顶点的UV坐标.
+3. 声明输出变量. 变量基于顶点数据为每个片元插值然后传送给片元着色器.
+4. `gl_Position` 被设置为当前顶点在投射空间的输出坐标. 包含四项: `x`, `y`, `z` 和 `w`. 其中 `w` 用于计算透视校正插值. 应用转换矩阵前一般都取值为 1.0.
+5. 设置当前顶点的 varying UV 坐标. 栅格化之后它会为每个片元进行插值计算然后发送给片元着色器.
 
 
 
 
-After vertex shading, the on screen shape of the component is decided: primitive shapes are generated and rasterized, meaning that the graphics hardware splits each shape into *fragments*, or pixels. It then runs the fragment shader program, once for each of the fragments. For an on screen image 16x24 pixels in size, the program runs 384 times, each in parallell.
+顶点着色器运行完, 组件的屏幕投射形状已被计算出来: 原始形状生成并被栅格化, 就是显卡把要显示的东西分解成 *片元*, 或理解为像素. 然后运行片元着色器, 每个片元处理运行一次. 对于屏幕上显示的 16x24 像素大小的图片, 片元着色程序要并行运行384次.
 
 ![fragment shader](images/shader/fragment_shader.png){srcset="images/shader/[email protected] 2x"}
 
-The input of the program is whatever the rendering pipeline and the vertex shader sends, usually the *uv-coordinates* of the fragment, tint colors etc. The output is the final color of the pixel (`gl_FragColor`).
+片元着色程序输入的是渲染管线和顶点着色器发来的数据, 一般是片元的 *uv坐标*, 染色颜色之类的. 而输出的是最终颜色值 (`gl_FragColor`).
 
-The most simple fragment shader program just sets the color of each pixel to black (again, not a very useful program):
+最简单的片元着色程序大概就是把每个像素设置为黑色 (还是没什么用):
 
 ```glsl
 void main()
@@ -157,7 +157,7 @@ void main()
 }
 ```
 
-Again, a more complete example is the built in sprite fragment shader:
+复杂一点的比如sprite的片元着色程序:
 
 ```glsl
 // sprite.fp
@@ -173,19 +173,19 @@ void main()
   gl_FragColor = diff * tint_pm;                                // [6]
 }
 ```
-1. The varying texture coordinate variable is declared. The value of this variable will be interpolated for each fragment between the values set for each vertex in the shape.
-2. A `sampler2D` uniform variable is declared. The sampler, together with the interpolated texture coordinates, is used to perform texture lookup so the sprite can be textured properly. Since this is a sprite, the engine will assign this sampler to the image set in the sprite's *Image* property.
-3. A constant of type `CONSTANT_TYPE_USER` is defined in the material and declared as a `uniform`. Its valueis used to allow color tinting of the sprite. The default is pure white.
-4. The color value of the tint gets pre-multiplied with its alpha value since all runtime textures already contain pre-multiplied alpha.
-5. Sample the texture at the interpolated coordinate and return the sampled value.
-6. `gl_FragColor` is set to the output color for the fragment: the diffuse color from the texture multiplied with the tint value.
+1. 声明 varying 纹理坐标变量. 此变量基于形状顶点为每个片元进行插值.
+2. 声明 `sampler2D` uniform 变量. 取样器, 连同插值纹理坐标, 用于sprite的纹理采样. 对于sprite来说, 引擎会自动把要采样的纹理对应到sprite的 *Image* 属性上.
+3. 定义 `CONSTANT_TYPE_USER` 材质常量并且声明为 `uniform`. 用来给sprite设置染色颜色. 默认值纯白.
+4. 染色颜色于其不透明度相乘, 因为运行时纹理颜色都是经过不透明度预乘的.
+5. 在插值坐标处采样并返回颜色值.
+6. `gl_FragColor` 代表片元最终颜色结果: 漫反射纹理颜色于其染色颜色的乘积.
 
-The resulting fragment value then goes through tests. A common test is the *depth test* in where the fragment's depth value is compared against the depth buffer value for the pixel that is being tested. Depending on the test, the fragment can be discarded or a new value is written to the depth buffer. A common use of this test is to allow graphics that is closer to the camera to block graphics further back.
+得到片元的最终颜色后还要经过一系列测试. 常见的有 *深度检测*, 看片元深度值是否与像素深度缓存相匹配. 经过测试后, 片元可能被丢弃或者深度缓存被赋予新的值. 这个检测常用于计算远离摄像机物体的渲染剔除工作.
 
-If the test concluded that the fragment is to be written to the frame buffer, it will be *blended* with the pixel data already present in the buffer. Blending parameters that are set in the render script allow the source color (the value written by the fragment shader) and the destination color (the color from the image in the framebuffer) to be combined in various ways. A common use of blending is to enable rendering transparent objects.
+如果这个片元被保留下来, 它还要与早先进入帧缓存的像素数据进行 *混合*. 渲染脚本基于混合参数将源颜色 (片元着色器输出颜色) 与目标颜色 (帧缓存里已有颜色) 进行混合计算. 混合计算常见用法如显示半透明图像等.
 
-## Further study
+## 深入学习
 
-- The site Shadertoy (https://www.shadertoy.com) contains a massive number of user contributed shaders. It is a great source of inspiration where you can learn about various shading techniques. Many of the shaders showcased on the site can be ported to Defold with very little work. The [Shadertoy tutorial](https://www.defold.com/tutorials/shadertoy/) goes through the steps of converting an existing shader to Defold.
+- 著名着色器开源站 Shadertoy (https://www.shadertoy.com) 上有大量开发者开源着色器. 可以通过学习各种着色技术作为自己的灵感源泉. 其中很多着色器改改就能应用到 Defold 中去. [Shadertoy 教程](https://www.defold.com/tutorials/shadertoy/) 介绍了把网站着色器用于 Defold 的具体步骤.
 
-- The [Grading tutorial](https://www.defold.com/tutorials/grading/) shows how to create a full screen color grading effect using color lookup table textures for the grading.
+- [渐变教程](https://www.defold.com/tutorials/grading/) 介绍了使用纹理采样进行全屏颜色渐变效果的编写方法.

+ 1 - 1
docs/zh/manuals/spinemodel.md

@@ -32,7 +32,7 @@ SpineModel 组件用于把 _Spine_ 骨骼动画在 Defold 中呈现出来.
 : 设置Spine模型默认的动画.
 
 *Skin*
-: 如果模型包含皮肤的话这里可以设置Spine模型的默认皮肤.
+: 如果模型包含皮肤的话,这里可以设置Spine模型的默认皮肤.
 
 此时就可以在编辑器里看到Spine模型了:
 

+ 1 - 1
docs/zh/manuals/texture-filtering.md

@@ -13,7 +13,7 @@ Nearest
 Linear
 : 屏幕像素颜色取决于图素及其旁边图素的颜色的平均值. 这样缓慢的移动能显得十分平滑, 因为渲染之前Sprite的颜色已经与周围进行了融合--所以移动小于一个像素距离也是可以的.
 
-过滤设置保存在 [项目设置](/manuals/project-settings/#graphics) 文件里. 一共有两项:
+过滤设置保存在 [项目设置](/manuals/project-settings/#Graphics) 文件里. 一共有两项:
 
 default_texture_min_filter
 : 当图素小于屏幕像素大小, 要缩小时使用的过滤效果.

+ 66 - 66
docs/zh/manuals/texture-profiles.md

@@ -1,140 +1,140 @@
 ---
 title: Defold 中的纹理档案
-brief: Defold supports automatic texture processing and compression of image data. This manual describes the available functionality.
+brief: Defold 支持自动纹理处理和数据压缩. 本教程介绍了这类功能.
 ---
 
 # 纹理档案
 
-Defold supports automatic texture processing and compression of image data (in *Atlas*, *Tile sources*, *Cubemaps* and stand-alone textures used for models, GUI etc).
+Defold 可以自动把图片数据处理成纹理并进行压缩 (称为 *Atlas*, *Tile sources*, *Cubemaps* 和模型纹理, GUI资源等等).
 
-There are two types of compression, software image compression and hardware texture compression.
+压缩有两种, 图片软件压缩与纹理硬件压缩.
 
-1. Software compression (such as PNG and JPEG) reduces the storage size of image resources. This makes the the final bundle size smaller. However, the image files need to be uncompressed when read into memory so even though an image is small on disk, it can have a large memory footprint.
+1. 软件压缩 (比如 PNG 和 JPEG) 减少了图片占用空间. 可以让成品打包小一点. 但是读取到内存的时候必须解压, 硬盘上很小的图片, 都可能占用大量内存空间.
 
-2. Hardware texture compression also reduces the storage size of image resources. But, unlike software compression, it reduces the in-memory footprint for textures. This is because the graphics hardware is able to directly manage compressed textures without first having to uncompress them.
+2. 硬件压缩也是减小图片占用空间. 区别于软件压缩的是, 纹理的内存占用也能减少. 这是因为图像硬件可以直接处理压缩图片而省去了解压过程.
 
-The processing of textures is configured through a specific texture profile. In this file you create _profiles_ that express what compressed format(s) and type should be used when creating bundles for a specific platform. _Profiles_ are then tied to matching file _paths patterns_, allowing fine tuned control over what files in your project should be compressed and exactly how.
+纹理的处理基于纹理档案的设定. _Profiles_ 描述了不同平台下使用哪种压缩格式和纹理类型. _Profiles_ 绑定了 _paths patterns_, 用以微调和确定实际的压缩算法.
 
-Since all available hardware texture compression is lossy, you will get artifacts in your texture data. These artifacts are highly dependent on how your source material looks and what compression method is used. You should test your source material and experiment to get the best results. Google is your friend here.
+因为所有硬件压缩都是有损的, 纹理数据可能会不如压缩前好看. 造成这种现象的原因高度取决于材质和压缩算法. 为了得到最好的效果就需要多多尝试. 别忘了 Google 是你的好伙伴.
 
-You can select what software image compression is applied on the final texture data (compressed or raw) in the bundle archives. Defold supports WebP or ZLib (default). WebP supports both lossy and lossless compression and usually results in significantly better compression than ZLib, which is a general data compression algorithm
+软件压缩方面可以在打包时选择如何保存纹理数据 (压缩或者原图). Defold 支持 WebP 和 ZLib (默认) 算法. WebP 支持有损无损两种方式, 通常比 ZLib 效果好, ZLib 效果一般.
 
-::: sidenote
-Compression is a resource intensive and time consuming operation that can cause _very_ long build times depending on the number of texture images to compress and also the chosen texture formats and type of software compression.
+::: 注意
+压缩属于资源密集型耗时操作, 图片多的话可以 _大大_ 增加编译时间. 就连选择纹理压缩格式和类型也非常耗时.
 :::
 
-## Texture profiles
+## 纹理档案
 
-Each project contains a specific *.texture_profiles* file that contains the configuration used when compressing textures. By default, this file is *builtins/graphics/default.texture_profiles* and it has a configuration matching every texture resource to a profile using RGBA with no hardware texture compression and using the default ZLib file compression.
+每个项目都有 *.texture_profiles* 文件用来进行纹理压缩设置. 默认情况下, 这个文件位于 *builtins/graphics/default.texture_profiles* 并且设置为所有纹理都绑定一个档案就是使用 RGBA 不进行硬件压缩并且使用默认 ZLib 压缩算法.
 
-To add texture compression:
+新增纹理压缩:
 
-- Select <kbd>File ▸ New...</kbd> and choose *Texture Profiles* to create a new texture profiles file. (Alternatively copy *default.texture_profiles* to a location outside of *builtins*)
-- Choose a name and location for the new file.
-- Change the *texture_profiles* entry in *game.project* to point to the new file.
-- Open the *.texture_profiles* file and configure it according to your requirements.
+- 点击 <kbd>File ▸ New...</kbd> 选择 *Texture Profiles* 来新建纹理档案文件. (或者把 *default.texture_profiles* 拷贝到 *builtins* 之外的项目文件夹下)
+- 命名文件.
+- 在 *game.project* 里的 *texture_profiles* 项上引用这个文件.
+- 打开 *.texture_profiles* 文件进行自己需要的配置.
 
 ![New profiles file](images/texture_profiles/texture_profiles_new_file.png)
 
 ![Setting the texture profile](images/texture_profiles/texture_profiles_game_project.png)
 
-You can turn on and off the use of texture profiles in the editor preferences. Select <kbd>File ▸ Preferences...</kbd>. The *General* tab contains a checkbox item *Enable texture profiles*.
+你可以选择启用还是禁用纹理档案. 点击 <kbd>File ▸ Preferences...</kbd>. 在 *General* 部分就有 *Enable texture profiles* 选项.
 
 ![Texture profiles preferences](images/texture_profiles/texture_profiles_preferences.png)
 
-## Path Settings
+## 路径设置
 
-The *Path Settings* section of the texture profiles file contains a list of path patterns and which *profile* to use when processing resources that match the path. The paths are expressed as "Ant Glob" patterns (see http://ant.apache.org/manual/dirtasks.html#patterns for details). Patterns can be expressed using the following wildcards:
+纹理档案的 *Path Settings* 部分是一个 *profile* 表格用以引用各种档案路径. 路径使用 "Ant Glob" 样式 (详情请见 http://ant.apache.org/manual/dirtasks.html#patterns) 表示. 样式中可以使用通配符:
 
 `*`
-: Matches zero or more characters. For instance `sprite*.png` matches the files *sprite.png*, *sprite1.png* and *sprite_with_a_long_name.png*.
+: 匹配0个或多个字符. 例如 `sprite*.png` 匹配文件 *sprite.png*, *sprite1.png* 和 *sprite_with_a_long_name.png*.
 
 `?`
-: Matches exactly one character. For instance: `sprite?.png` matches the files *sprite1.png*, *spriteA.png* but not *sprite.png* or *sprite_with_a_long_name.png*.
+: 匹配1个字符. 例如 `sprite?.png` 匹配文件 *sprite1.png*, *spriteA.png*, 但是不匹配文件 *sprite.png* 和 *sprite_with_a_long_name.png*.
 
 `**`
-: Matches a complete directory tree, or---when used as the name of a directory---zero or more directories. For instance: `/gui/**` matches all files in the directory */gui* and all its subdirectories.
+: 匹配一个目录树, 或者在目录名中使用时可匹配多个目录. 例如 `/gui/**` 匹配 */gui* 及其所有子目录下的文件.
 
 ![Paths](images/texture_profiles/texture_profiles_paths.png)
 
-This example contains two path patterns and their corresponding profiles.
+本例中引用了两个档案路径.
 
 `/gui/**/*.atlas`
-: All *.atlas* files in directory */gui* or any of its subdirectories will be processed according to profile "gui_atlas".
+: 在 */gui* 下及其子目录下的所有 *.atlas* 文件被描述为 "gui_atlas" 档案.
 
 `/**/*.atlas`
-: All *.atlas* files anywhere in the project will be process according to the profile "atlas".
+: 项目中所有 *.atlas* 文件被描述为 "atlas" 档案.
 
-Note that the more generic path is put last. The matcher works top down. The first occurrence that matches the resource path will be used. A matching path expression further down the list never overrides the first match. Had the paths been put in the opposite order every atlas would have been processed with profile "atlas", even the ones in directory */gui*.
+注意把广泛匹配放在下面. 文件匹配是从上到下进行的. 上面的匹配优先与下面的. 下面的档案不会覆盖上面的. 否则的话所有 "atlas" 都被第二条匹配了, 包括第一条 */gui* 下的.
 
-Texture resources that _do not_ match any path in the profiles file will be compiled and rescaled to the closest power of 2, but will otherwise be left intact.
+对于 _没有被_ 匹配到的纹理会被编译且缩放为最近的2次方幂大小, 或者不做任何压缩处理.
 
-## Profiles
+## 档案
 
-The *profiles* section of the texture profiles file contains a list of named profiles. Each profile contains one or more *platforms*, each platform being described by a list of properties.
+*profiles* 包含与上述对应的档案表. 每个档案包含一个或多个 *platforms*, 每个平台又包括一系列属性设定.
 
 ![Profiles](images/texture_profiles/texture_profiles_profiles.png)
 
 *Platforms*
-: Specifies a matching platform. `OS_ID_GENERIC` matches all platforms including dev-app builds on device, `OS_ID_WINDOWS` matches Windows target bundles, `OS_ID_IOS` matches iOS bundles and so on. Note that if `OS_ID_GENERIC` is specified, it will be included for all platforms.
+: 指定平台. `OS_ID_GENERIC` 匹配所有平台, `OS_ID_WINDOWS` 对应 Windows 平台, `OS_ID_IOS` 对应 iOS 平台. 注意如果使用 `OS_ID_GENERIC`, 设定将会对所有平台生效.
 
-::: important
-If two [path settings](#path-settings) matches the same file and the path uses different profiles with different platforms **both** profiles will be used and **two** texture will be generated.
+::: 注意
+如果两个 [路径样式](#path-settings) 匹配一个文件并且这两个路径分别指定不同的平台, 那么这 **两个** 档案都会生效, 所以会生成 **两个** 纹理.
 :::
 
 *Formats*
-: One or more texture formats to generate. If several formats are specified, textures for each format are generated and included in the bundle. The engine selects textures of a format that is supported by the runtime platform.
+: 纹理格式. 如果指定多个, 每个格式都会生效. 引擎会在运行时选择合适的纹理格式.
 
 *Mipmaps*
-: If checked, mipmaps are generated for the platform. Checked by default.
+: 是否生成mipmap. 默认勾选.
 
 *Premultiply alpha*
-: If checked, alpha is premultiplied into the texture data. Checked by default.
+: 是否预乘alpha. 默认勾选.
 
 *Max Texture Size*
-: If set to a non-zero value, textures are limited in pixel size to the specified number. Any texture that has a width or height larger than the specified value will be scaled down.
+: 如果填入非0值, 纹理将限制最大尺寸为填入值. 如果图片本身比填入值打, 纹理会被缩小.
 
-The *Formats* added to a profile each have the following properties:
+对于每个档案的每个 *Formats*, 又有以下属性设定:
 
 *Format*
-: The format to use when encoding the texture. See below for all available texture formats.
+: 纹理编码格式. 可用格式见下文.
 
 *Compression*
-: Selects the quality level for the resulting compressed image. The values range from `FAST` (lowest quality, fast compression) to `BEST` (highest quality, slowest compression).
+: 压缩图片的质量等级. 取值从 `FAST` (质量最差, 速度最快) 到 `BEST` (质量最高, 速度最慢).
 
 *Type*
-: Selects the type of compression used for the resulting compressed image, `COMPRESSION_TYPE_DEFAULT`, `COMPRESSION_TYPE_WEBP` or `COMPRESSION_TYPE_WEBP_LOSSY`. See [Compression Types](#compression-types) below for more details.
+: 压缩类型, 可选值有 `COMPRESSION_TYPE_DEFAULT`, `COMPRESSION_TYPE_WEBP` 和 `COMPRESSION_TYPE_WEBP_LOSSY`. 详见下文 [压缩类型](#compression-types).
 
-## Texture formats
+## 纹理格式
 
-Graphics hardware textures can be processed into uncompressed or *lossy* compressed data with various numbers of channels and bit depths. Hardware compression that is fixed means that the resulting image will be of a fixed size, regardless of the image content. This means that the quality loss during compression depends on the content of the original texture.
+硬件可以直接处理未压缩纹理以及 *有损* 压缩纹理. 固定硬件压缩意思是纹理大小是一定的, 而不论纹理的内容. 一定意义上原图内容决定了硬件压缩后纹理的质量.
 
-The following lossy compression formats are currently supported.
+目前支持以下有损压缩.
 
 <!--
 DXT
-: Also called S3 Texture Compression. It can be generated on Windows platform only, but OS X supports reading it and it's possible to install support for it on Linux. The format divides the image into 4x4 pixel blocks with 4 colors set to the pixels within each block.
+: 也叫 S3 纹理压缩. 原本只在Windows上应用, 但是 OS X 支持了这种格式的读取而 Linux 可以用安装软件的方法支持这种格式. 其原理是把图片分为 4x4 像素大小的图块每个图块每个像素四个颜色通道.
 -->
 
 PVRTC
-: Textures are compressed in blocks. In 4 bit mode (4BPP) each block is 4×4 pixels. In 2 bit mode (2BPP) each block is 8×4 pixels. Each block always occupies 64 bits (8 bytes) of memory space.  The format is used in all generations of the iPhone, iPod Touch, and iPad. (certain Android devices, that use PowerVR GPUs, also support the format). Defold supports PVRTC1, as indicated by the suffix "V1" in the format identifiers.
+: 也是一种图块压缩方法. 在4比特模式 (4BPP) 下每个图块 4×4 像素. 在2比特模式 (2BPP) 下每个图块 8×4 像素. 每个图块占用 64 比特 (8 字节) 内存空间.  这种格式原本用于 iPhone, iPod Touch, 和 iPad. 目前使用 PowerVR GPU 的 Android 设备, 也支持这种格式. Defold 支持 PVRTC1, 在格式id中用后缀 "V1" 表示.
 
 ETC
-: Ericsson Texture Compression. Blocks of 4×4 pixels are compressed into a single 64-bit word. The 4×4 block is divided in half and each half is assigned a base color. Each pixel is then encoded as one of four offset values from the base color of its half. Android supports ETC1 since version 2.2 (Froyo). Defold compresses ETC1 textures.
+: 爱立信纹理压缩格式. 4×4 像素块再次压缩为 64 比特数据. 4×4 像素块一分为二然后给每块指定一个基础颜色. 每个像素编码为这个基础颜色的四通道偏移量. Android 从 2.2 版 (Froyo) 开始支持 ETC1. Defold 支持 ETC1 纹理压缩格式.
 
-| Format                            | Compression | Details  |
+| 格式                            | 压缩 | 描述  |
 | --------------------------------- | ----------- | -------------------------------- | ---- |
-| `TEXTURE_FORMAT_RGB`              | none        | 3 channel color. Alpha is discarded |
-| `TEXTURE_FORMAT_RGBA`             | none        | 3 channel color and full alpha.    |
-| `TEXTURE_FORMAT_RGB_16BPP`        | none        | 3 channel color. 5+6+5 bits. |
-| `TEXTURE_FORMAT_RGBA_16BPP`       | none        | 3 channel color and full alpha. 4+4+4+4 bits. |
-| `TEXTURE_FORMAT_LUMINANCE`        | none        | 1 channel gray-scale, no alpha. RGB channels multiplied into one. Alpha is discarded. |
-| `TEXTURE_FORMAT_LUMINANCE_ALPHA`  | none        | 1 channel gray-scale and full alpha. RGB channels multiplied into one. |
-| `TEXTURE_FORMAT_RGB_PVRTC2BPPV1`  | 1:16 fixed. | No alpha. Requires square images. Non square images will be resized. |
-| `TEXTURE_FORMAT_RGB_PVRTC4BPPV1`  | 1:8 fixed   | No alpha. Requires square images. Non square images will be resized. |
-| `TEXTURE_FORMAT_RGBA_PVRTC2BPPV1` | 1:16 fixed | Pre-multiplied alpha. Requires square images. Non square images will be resized. |
-| `TEXTURE_FORMAT_RGBA_PVRTC4BPPV1` | 1:8 fixed. | Pre-multiplied alpha. Requires square images. Non square images will be resized. |
-| `TEXTURE_FORMAT_RGB_ETC1`         | 1:6 fixed  | No alpha |
+| `TEXTURE_FORMAT_RGB`              | none        | 3 颜色通道. Alpha 被丢弃 |
+| `TEXTURE_FORMAT_RGBA`             | none        | 3 颜色通道和 1 alpha 通道.    |
+| `TEXTURE_FORMAT_RGB_16BPP`        | none        | 3 颜色通道. 5+6+5 比特. |
+| `TEXTURE_FORMAT_RGBA_16BPP`       | none        | 3 颜色通道和 1 alpha 通道. 4+4+4+4 比特. |
+| `TEXTURE_FORMAT_LUMINANCE`        | none        | 1 灰度通道, 无 alpha 通道. RGB 编码为 1 颜色通道. Alpha 被丢弃. |
+| `TEXTURE_FORMAT_LUMINANCE_ALPHA`  | none        | 1 灰度通道和 1 alpha 通道. RGB 编码为 1 颜色通道. |
+| `TEXTURE_FORMAT_RGB_PVRTC2BPPV1`  | 1:16 固定. | 无 alpha 通道. 正方形图片. 非正方形图片会被裁剪. |
+| `TEXTURE_FORMAT_RGB_PVRTC4BPPV1`  | 1:8 固定   | 无 alpha 通道. 正方形图片. 非正方形图片会被裁剪. |
+| `TEXTURE_FORMAT_RGBA_PVRTC2BPPV1` | 1:16 固定 | 预乘 alpha. 正方形图片. 非正方形图片会被裁剪. |
+| `TEXTURE_FORMAT_RGBA_PVRTC4BPPV1` | 1:8 固定. | 预乘 alpha. 正方形图片. 非正方形图片会被裁剪. |
+| `TEXTURE_FORMAT_RGB_ETC1`         | 1:6 固定  | 无 alpha 通道. |
 
 <!---
 | TEXTURE_FORMAT_RGB_DTX1
@@ -158,14 +158,14 @@ ETC
 | Can be compressed on Windows only
 -->
 
-## Compression types
+## 压缩类型
 
-The following software image compression types are supported. The data is uncompressed when the texture file is loaded into memory.
+支持以下软件压缩类型. 载入内存时需要解压.
 
-| Type                              | Formats                   | Note |
+| 类型                              | 格式                   | 描述 |
 | --------------------------------- | ------------------------- | ---- |
-| `COMPRESSION_TYPE_DEFAULT`        | All formats               | Generic lossless data compression. Default. |
-| `COMPRESSION_TYPE_WEBP`           | All formats               | WebP lossless compression. Higher quality level results in smaller size. |
-| `COMPRESSION_TYPE_WEBP_LOSSY`     | All non hardware compressed formats. | WebP lossy compression. Lower quality level results in smaller size. |
+| `COMPRESSION_TYPE_DEFAULT`        | 所有格式               | 简单无损压缩, 默认值. |
+| `COMPRESSION_TYPE_WEBP`           | 所有格式               | WebP 无损压缩. 高质量小体积. |
+| `COMPRESSION_TYPE_WEBP_LOSSY`     | 所有非硬件压缩格式 | WebP 有损压缩. 降低质量再降低体积. |
 
-For hardware compressed texture formats PVRTC or ETC, the WebP lossless compression process transforms the compressed hardware texture format data into data more suitable for WebP image compression using an internal intermediate format. This is then transformed back into the compressed hardware texture format when loaded by the run-time. WebP lossy type is currently not supported for hardware compressed texture formats PVRTC and ETC.
+对于硬件压缩纹理格式PVRTC或ETC, WebP无损压缩过程使用内部中间格式将压缩的硬件纹理格式数据转换为更适合WebP图像压缩的数据. 然后在运行时加载时将其转换回压缩的硬件纹理格式. 硬件压缩纹理格式PVRTC和ETC目前不支持WebP有损类型.

+ 2 - 4
docs/zh/manuals/web-monetization.md

@@ -36,8 +36,6 @@ brief: 网页游戏盈利是用网页游戏获利的一种手段, 开发者获
 
 [![GateHub logo](images/web-monetization/gatehub_logo.svg)](https://gatehub.net)
 
-[![Stronghold logo](images/web-monetization/stronghold_logo.svg)](https://stronghold.co/real-time-payments#coil)
-
 
 ### 支付点
 
@@ -65,14 +63,14 @@ $ilp.uphold.com/QkG86UgXzKq8
 
 ![Web Monetization template](images/web-monetization/web-monetization-template.png)
 
-下一步注册 [网页支付钱包](/manuals/web-monetization/#web-monetization-wallets) 然后在 **game.project** 文件的 Web Monetization 部分将支付点与钱包挂接:
+下一步注册 [网页钱包账户](/manuals/web-monetization/#网页钱包账户) 然后在 **game.project** 文件的 Web Monetization 部分将支付点与钱包挂接:
 
 ![Adding payment pointer to game.project](images/web-monetization/payment-pointer.png)
 
 
 ### 已有项目
 
-首先注册 [网页支付钱包](/manuals/web-monetization/#web-monetization-wallets) 然后手动在网页中加入支付点:
+首先注册 [网页钱包账户](/manuals/web-monetization/#网页钱包账户) 然后手动在网页中加入支付点:
 
 ```html
 <meta name="monetization" content="YOUR_PAYMENT_POINTER">

+ 1 - 1
docs/zh/manuals/windows.md

@@ -9,7 +9,7 @@ brief: 本教程介绍了在 Windows 平台下如何编译和运行 Defold 应
 
 ## 项目设置
 
-Windows 相关设置位于*game.project* 文件的 [Windows部分](/manuals/project-settings/#windows)  .
+Windows 相关设置位于*game.project* 文件的 [Windows部分](/manuals/project-settings/#Windows)  .
 
 ## 应用图标
 

+ 2 - 2
docs/zh/manuals/working-offline.md

@@ -24,14 +24,14 @@ Defold 定期查找是否存在更新版本. Defold 查找新版本时会连接
 
 如果编辑器发现了错误就会弹出错误报告框让用户选择是否把错误内容回报给 Defold 官方. 错误跟踪表 [存储在 GitHub 上](https://www.github.com/defold/editor2-issues), 所以回报问题时需要联网.
 
-如果在离线状态下遇到错误还可以使用编辑器的 [帮助菜单下的回报错误按钮](/manuals/getting-help/#report-a-problem-from-the-editor) 提交错误报告.
+如果在离线状态下遇到错误还可以使用编辑器的 [帮助菜单下的回报错误按钮](/manuals/getting-help/#从编辑器里汇报问题) 提交错误报告.
 
 
 ## 下载依赖
 
 Defold 支持通过一个叫做 [库项目](/manuals/libraries/) 的功能共享代码和资源. 库被保存为zip文件存放在网络上. 一般 Defold 库项目都保存在 GitHub 和各个代码托管平台上.
 
-在项目设置里可以添加库 [作为项目依赖](/manuals/project-settings/#dependencies). 当项目开启或者 *Project* 菜单栏下的 *Fetch Libraries* 被点选时, Defold 会自动进行项目依赖的下载/更新.
+在项目设置里可以添加库 [作为项目依赖](/manuals/project-settings/#Dependencies). 当项目开启或者 *Project* 菜单栏下的 *Fetch Libraries* 被点选时, Defold 会自动进行项目依赖的下载/更新.
 
 如果必须团队离线工作, 建议把共享依赖存放在本地共享服务器上. GitHub 上的依赖库文件一般都在其发布页面: