reuse-scripts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEngine scripts
引擎脚本
The installed package ships production scripts under . Discover the
current set rather than maintaining a stale list:
playcanvasscripts/esm/**sh
rg 'static scriptName =' node_modules/playcanvas/scripts/esm \
| sed "s|.*/scripts/esm/||; s|:.*static scriptName = ['\"]| -> |; s|['\"].*||" \
| sortRead the selected file for its named export, properties, and defaults. Not every module
is a ; the parsers below are plain classes registered with a resource
handler instead.
@attributeScriptscripts/esm/parsersOnly import from . Legacy sibling directories depend on the global Engine namespace.
After selecting a script, use to locate its matching versioned Engine example.
scripts/esm/**find-examplesUse a relevant shipped script as the default implementation. If it cannot own the whole feature,
preserve its input signs, angular damping, bounds, and lifecycle invariants in the custom portion
instead of replacing them from memory.
已安装的包在目录下提供生产脚本。请探索当前可用的脚本集合,而非维护一份过时的列表:
playcanvasscripts/esm/**sh
rg 'static scriptName =' node_modules/playcanvas/scripts/esm \
| sed "s|.*/scripts/esm/||; s|:.*static scriptName = ['\"]| -> |; s|['\"].*||" \
| sort查看所选文件的命名导出、属性及默认值。并非所有模块都是;下的解析器是注册到资源处理器的普通类。
@attributeScriptscripts/esm/parsers仅从导入。旧的同级目录依赖全局Engine命名空间。选择脚本后,使用查找对应的版本化引擎示例。
scripts/esm/**find-examples使用相关的内置脚本作为默认实现。如果它无法覆盖整个功能,请在自定义部分保留其输入标识、角阻尼、边界和生命周期不变量,而非凭记忆重新实现。
Reproduce the reference integration
复现参考集成
Treat the selected script source and its closest official example as complementary references:
- Read the source for exports, properties, defaults, fallbacks, required components, and lifecycle.
- Read the example for assets, entity references, mesh requirements, layer ordering, scene settings, and render-pipeline setup.
- Reproduce the smallest working baseline before customizing it. Preserve defaults that are not deliberately changed, and tune one property group at a time.
- After a rendered frame, fail on console, shader, or missing-asset diagnostics. Exercise the behavior with real input where applicable and inspect returned screenshots from representative views at the final backbuffer density.
- Compare the result with the official example when visual quality matters. Keep iterating or report the gap; a running fallback is not proof of correct integration.
If no matching example exists, state that and derive the integration from installed source instead
of inventing it from memory.
For an outdoor water scene, start from as one integration recipe. It
combines , , , , a dedicated water layer, scene
depth, normal and caustics textures, and conservative rendering defaults. Establish that complete
baseline before adapting its camera, assets, time of day, or water tuning.
graphics/water.example.mjsWaterProceduralSkyCameraControlsCameraFrame将所选脚本源码及其最匹配的官方示例视为互补参考:
- 查看源码中的导出内容、属性、默认值、回退机制、所需组件及生命周期。
- 查看示例中的资源、实体引用、网格要求、图层顺序、场景设置及渲染管线配置。
- 在自定义之前,先复现最小可工作基线。保留未刻意修改的默认值,每次仅调整一组属性。
- 渲染一帧后,检查控制台、着色器或缺失资源的诊断信息。在适用情况下使用真实输入测试行为,并以最终后台缓冲区分辨率检查代表性视角的截图。
- 当视觉质量重要时,将结果与官方示例对比。持续迭代或报告差异;可运行的回退方案并不代表集成正确。
如果没有匹配的示例,请注明这一点,并从已安装的源码中推导集成方式,而非凭记忆凭空创造。
对于户外水面场景,可以从开始作为集成方案。它结合了、、、、专用水图层、场景深度、法线和焦散纹理,以及保守的渲染默认值。在调整相机、资源、时间或水面参数之前,先建立完整的基线。
graphics/water.example.mjsWaterProceduralSkyCameraControlsCameraFramePreserve grouped defaults
保留分组默认值
Grouped property updates differ by authoring surface. Read the selected reference and preserve
defaults that are not being changed.
Read exactly one reference matching the code being edited:
direct Engine, React, or
Web Components. Choose from imports and markup, not installed
dependencies alone.
分组属性更新因创作界面而异。请查看所选参考文档,并保留未修改的默认值。
请查看与正在编辑的代码完全匹配的参考文档:直接Engine、React或Web Components。请从导入和标记中选择,而非仅依赖已安装的依赖项。