Skip to content

Commit

Permalink
update buffer.md & physics-shapes.md (#389)
Browse files Browse the repository at this point in the history
* pi / 4

* inputs

* forum url

* read only user

* html5 gamepad

* sdk api update

* update

* image properties

* update editor

* defold sdk update

* animation updates

* animation fix

* run as admin

* 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](#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
  • Loading branch information
CocosGames authored Feb 7, 2024
1 parent 033ea67 commit 2241444
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
33 changes: 33 additions & 0 deletions docs/zh/manuals/buffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: 缓存教程
brief: 本教程介绍了 Defold 的缓存资源.
---

# Buffer

缓存资源用来描述一个或多个数据流, 比如位置或颜色. 每种流有名字, 数据类型, 数目及数据自身. 例如:

```
[
{
"name": "position",
"type": "float32",
"count": 3,
"data": [
-1.0,
-1.0,
-1.0,
-1.0,
-1.0,
1.0,
...
]
}
]
```

上例描述了三维位置数据流, 用 32-bit 浮点数表示. 缓存类型是 JSON, 文件扩展名是 `.buffer`.

缓存资源一般由扩展工具或脚本创建, 比如用 Blender 导出模型时创建.

缓存资源可以用作 [模型资源](/manuals/mesh) 的数据. 缓存资源还可以使用 `buffer.create()`[相关 API 函数](/ref/stable/buffer/#buffer.create:element_count-declaration) 在运行时创建.
33 changes: 32 additions & 1 deletion docs/zh/manuals/physics-shapes.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Defold 包含一个功能就是从瓷砖地图中自动生成瓷磚圖源的物
:::

## 凸多边形
Defold 有一个功能就是让你用3个或多个点建立凸多边形. 可以使用资源 [Defold 多边形编辑器](/assets/defoldpolygoneditor/) 或者 [物理刚体编辑器](https://selimanac.github.io/physics-body-editor/) 来创建凸多边形.
Defold 有一个功能就是让你用3个或多个点建立凸多边形. 可以使用工具 [Defold 多边形编辑器](https://rossgrams.itch.io/defold-polygon-editor) 或者 [物理刚体编辑器](https://selimanac.github.io/physics-body-editor/) 来创建凸多边形.

1. 新建凸多边形文件 (扩展名 `.convexshape`).
2. 不在碰撞对象上加入形状, 而是设置 *Collision Shape* 属性为 *凸多边形文件*.
Expand All @@ -60,6 +60,37 @@ Defold 有一个功能就是让你用3个或多个点建立凸多边形. 可以
编辑器里不显示形状. 只有 [开启物理调试](/manuals/debugging-game-logic/#物理引擎调试) 才能在运行时看到形状.
:::

### 文件格式
凸多边形文件使用和 Defold 里其他资源文件一样的格式, 即 protobuf 文本格式. 凸多边形定义了逆时针顺序的顶点. 例如:

```
shape_type: TYPE_HULL
data: 200.000
data: 100.000
data: 0.0
data: 400.000
data: 100.000
data: 0.0
data: 400.000
data: 300.000
data: 0.0
data: 200.000
data: 300.000
data: 0.0
```

上例中定义了如下的矩形的四个角:

```
200x300 400x300
4---------3
| |
| |
| |
| |
1---------2
200x100 400x100
```

# 缩放碰撞形状
碰撞對象及其形狀繼承于游戲對象. 不想要該功能的話可以取消勾選 *game.project* 中物理部分下的 [Allow Dynamic Transforms](/manuals/project-settings/#allow-dynamic-transforms). 注意只有等比縮放受支持, 數值不等比的話以最小的一項數值為准.
Expand Down

0 comments on commit 2241444

Please sign in to comment.