座標を足し算する positions.add
ひとことで言うと
2 つの指定位置を追加して新しい位置を作成します。
ブロックとコード
~0 ~0 ~0+~0 ~0 ~0
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
positions.add(
pos(0, 0, 0),
pos(0, 0, 0)
)positions.add(pos(0, 0, 0), pos(0, 0, 0))引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| p1 | 座標 | 追加する最初の位置 |
| p2 | 座標 | 追加する二番目の位置 |
使用例
This code:
JavaScript
let relPosition = positions.add(
pos(2, 2, 2),
world(3, 3, 3)
)Python
relPosition = positions.add(pos(2, 2, 2), world(3, 3, 3))This code shows the opposite case:
JavaScript
let worldPosition = positions.add(
world(2, 2, 2),
pos(3, 3, 3)
)Python
worldPosition = positions.add(world(2, 2, 2), pos(3, 3, 3))Place a block of gold above the player's head by adding some extra height to the player's world position. This uses a relative position as the second position to add 2 blocks to the player's position.
JavaScript
blocks.place(GOLD_BLOCK, positions.add(
player.position(),
pos(0, 2, 0)
))Python
blocks.place(GOLD_BLOCK, positions.add(player.position(), pos(0, 2, 0)))