translate(tx, ty, tz)\ntranslate(axis, distance)
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
tx, ty, tz | float | — | 沿 scope X/Y/Z 轴的平移量。 |
axis | selector | — | 平移轴,如 world.x、world.y、scope.z 等。 |
distance | float | — | 沿指定轴的平移距离。 |
平移当前形状的 scope。支持两种形式:三轴分量形式或单轴距离形式。平移不改变几何体,只改变 scope 位置。
三轴平移:
Mass --> translate(0, 5, 0) Raised
沿世界 Y 轴平移:
Mass --> translate(world.y, 10) Raised
CGA.js 中的 translate 实现基于 CityEngine 2025.1 官方文档。
@StartRule\nLot --> primitiveCube(4, 4, 4)\n translate(2, 0, 0)\n color(0.5, 0.5, 1)