소스 검색

custom resource & physics.set_shape (#422)

* update bob

* update about AndroidX support

* software render

* linux-faq.md update

* 4.28.2021 updates

* Basis Universal format

* sound & mesh

* gamepad event mapping

* admob url

* Minor edit to building blocks intro text

* update gamepad & ios

* project settings

* libffi version

* scaling

* image compression

* update gamepads

* increase memory

* caching assets

* update 2021/10/6

* update 2021/10/16
blend-modes.md

* update 2021/11/12

* allow dynamic transforms update

* Bundle update

* update faq

* bullet & bob

* script properties update

* editor-styling

* build server url

* editor templates

* spine extension update

* Fix typo in the "optimizations" word in Chinese docs

* Update to material.md - Constants buffers

* Verify Graphics Calls

* H5 parameters

* OpenJDK downloads

* cn update corresponds to [pull 259](https://github.com/defold/doc/pull/259)

* application security

* porting guidelines

* update for 8f1651f

* cn update for 094bf6f

* cn update for 20fdfc5 & 6263317

* cn update for 7/19/2022

* title

* profiling update

* update editor.md

* update bob.md

* update shortcuts

* update fixed update note

* Update properties.md

* Update material.md

* Updates links

* Update bob help with the latest info

* camera & renderer

* Updated android keystore info zh_cn

* bundling.md release vs debug zh_cn

* update bob.md & gui-clipping.md

* contentless bundle

* consoles update

* model animation link

* gamepad & faq

* remove a camera lib

* font shadow render mode fix

* updates about app-manifest and others

* Update script.md

* includes in shaders

* editor scripts

* material updates

* Added dynamic atlas and texture creation

* fixes for atlas and some others

* update screenshots and add explanations (CN)

* add a line about Dynamic Prototype (CN)

* remove "inline" marks in pics

* de-translate the subtitle "Running the debugger" & images fix

* bundle identifier restrictions

* node properties Enabled and Visible (CN)

* release checklist & slice-9

* Update project-settings.md (CN)

* Update camera.md (CN)

* Update project-settings.md (CN)

* culling of meshes (CN)

* Update project-settings.md (CN)

* gltf model file support (CN)

* updates about factory (CN)

* Update bob.md (CN)

* Update bob.jar help (CN)

* Update about renderer and other things

* Update PS4 development and other things

* Dynamic prototype part of the collection factory.

* sync to atlas.md

* sync to design.md

* sync to gpgs.md

* sync to hot-reload.md

* sync to linux.md

* sync to live-update.md

* sync to lua.md

* sync to networking.md

* sync to physics-shapes.md

* sync to push.md

* sync to test.md

* sync to working-offline.md

* update material.md

* update zerobrane.md

* all done

* Splitting .zip archives in live-update.md

* manual for collision events

* Updated sprite documentation to include info about multiple textures

* update editor-scripts.md & physics-events.md

* update buffer.md & physics-shapes.md

* screen blend mode

* Update camera manual for zh with new function.

* Fix texture profile documentation for 1.7.0 zh

* update material.md & render.md

* notice about physics-events

* script-properties notes & PS5

* Clarified collision messages

* Update 3rd party camera list

* Fixed links in live update manual zh

* Update lua.md

* Update html5 manual with new information about CUSTOM_PARAMETERS. zh

* Added note on Apple Privacy Manifests zh

* typo

* Add info about collection proxies for zh

* fix minor mistakes

* typo

* custom resource & physics.set_shape
COCO 1 년 전
부모
커밋
95972caa07
4개의 변경된 파일30개의 추가작업 그리고 4개의 파일을 삭제
  1. 22 0
      docs/zh/manuals/physics-shapes.md
  2. 2 2
      docs/zh/manuals/project-settings.md
  3. 5 1
      docs/zh/manuals/resource.md
  4. 1 1
      docs/zh/manuals/tilesource.md

+ 22 - 0
docs/zh/manuals/physics-shapes.md

@@ -96,6 +96,28 @@ data: 0.0
 碰撞對象及其形狀繼承于游戲對象. 不想要該功能的話可以取消勾選 *game.project* 中物理部分下的 [Allow Dynamic Transforms](/manuals/project-settings/#allow-dynamic-transforms). 注意只有等比縮放受支持, 數值不等比的話以最小的一項數值為准.
 
 
+# 改变碰撞形状
+运行时可以使用 `physics.set_shape()` 改变碰撞形状. 例如:
+
+```lua
+-- 胶囊形状数据
+local data = {}
+data.diameter = 10
+data.height = 20
+physics.set_shape("#collisionobject", "my_capsule_shape", data)
+
+-- 圆形数据
+data = {}
+data.diameter = 10
+physics.set_shape("#collisionobject", "my_sphere_shape", data)
+
+-- 矩形数据
+data = {}
+data.dimensions = vmath.vector3(10, 10, 5)
+physics.set_shape("#collisionobject", "my_box_shape", data)
+```
+
+
 # 旋转碰撞形状
 
 ## 在3D物理世界中旋转碰撞形状

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

@@ -38,7 +38,7 @@ $ adb shell cat /mnt/sdcard/Android/data/com.defold.dmengine/files/log.txt
 
 #### Custom Resources
 `custom_resources`
-项目中包含的以逗号分隔的资源列表. 如指定的是目录, 则目录下所有文件及其子目录都会包含进去. 这些资源可以通过 [`sys.load_resource()`](/ref/sys/#sys.load_resource) 载入.
+项目中包含的以逗号分隔的资源列表. 如指定的是目录, 则目录下所有文件及其子目录都会包含进去. 这些资源可以通过 [`sys.load_resource()`](/ref/sys/#sys.load_resource) 载入. 自定义资源的加载详情请见 [文件存取教程](/manuals/file-access/#how-to-access-files-bundled-with-the-application).
 
 #### Bundle Resources
 `bundle_resources`
@@ -49,7 +49,7 @@ $ adb shell cat /mnt/sdcard/Android/data/com.defold.dmengine/files/log.txt
 支持包含名为 `common` 的文件夹, 可以在其中加入各平台公用的资源文件.
 
 不同平台访问 bundle 资源的方法不一样. 使用 Lua 的 `io` 模块是可行的. 但是要特别注意写对各平台的文件路径.
-(举例: 在安卓平台上要这么写 "file:///android_asset/")
+(举例: 在安卓平台上要这么写 "file:///android_asset/"). 文件的加载详情请见 [文件存取教程](/manuals/file-access/#how-to-access-files-bundled-with-the-application).
 
 #### Bundle Exclude Resources
 `bundle_exclude_resources`

+ 5 - 1
docs/zh/manuals/resource.md

@@ -14,10 +14,14 @@ brief: 本教程介绍了 Defold 如何自动管理资源以及如何手动加
 - 游戏对象和组件数据 (图集, 声音之类的).
 - 工厂组件原型 (游戏对象和集合).
 - 集合代理组件数据 (集合).
-- 在 *game.project* 中定义的用户数据.
+- 在 *game.project* 中声明的 [自定义资源](/manuals/project-settings/#custom-resources).
 
 ![Resource tree](images/resource/resource_tree.png)
 
+::: sidenote
+Defold 还有一个 [捆绑资源](/manuals/project-settings/#bundle-resources) 的概念. 捆绑资源存在于应用包体内, 但不存在于资源树之上. 捆绑资源可以是从平台特定的支持文件到 [文件系统加载](/manuals/file-access/#how-to-access-files-bundled-with-the-application) 的游戏所用的任何外部文件的数据 (例如 FMOD 声音库).
+:::
+
 游戏 *打包时*, 只保留资源树链接了的内容. 没被链接到的被剔除. 所以打包时不必手动选择哪些资源需要打包哪些资源不需要打包.
 
 游戏 *运行时*, 引擎会从资源树根开始把资源读入内存中:

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

@@ -93,7 +93,7 @@ Defold 为每个瓷砖 *Collision* 属性指定一个图片用于生成一个碰
 
 outline 视图会显示出你加在瓷砖图源上的碰撞组. 新创建的瓷砖图源默认加在 "default" 碰撞组上. 在 *Outline* 视图 <kbd>右键点击</kbd> 瓷砖图源根节点, 选择 <kbd>Add ▸ Collision Group</kbd> 以添加新的碰撞组.
 
-要指定一个组的碰撞形状, 在 *outline 视图* 中选中碰撞组, 然后点击希望加入该组的瓷砖. 瓷砖轮廓颜色会变得和碰撞组颜色一. 编辑器会为每个碰撞组自动分配颜色.
+要指定一个组的碰撞形状, 在 *outline 视图* 中选中碰撞组, 然后点击希望加入该组的瓷砖. 瓷砖轮廓颜色会变得和碰撞组颜色一. 编辑器会为每个碰撞组自动分配颜色.
 
 ![碰撞形状](images/tilemap/collision.png){srcset="images/tilemap/[email protected] 2x"}