カメラ基準の座標 posCamera
ひとことで言うと
新しくカメラ座標を作成する。右、上、前。
ブロックとコード
右0上0前0
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
posCamera(0, 0, 0)pos_camera(0, 0, 0)引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| x | 数値 | 左(-x)または右(+x)方向の座標(ブロック単位) |
| y | 数値 | 上(+y)または下(-y)方向の座標(ブロック単位) |
| z | 数値 | 後ろ(-z)または前(-z)方向の座標(ブロック単位) |
使用例
If the player is heading in a Northwest direction, the distance in front is in the North direction if the player's heading is more toward the North than the West. In the following example, an orange concrete block is placed in front of the player. This code will place the block on the North side of the player since the player is heading more toward the North.
JavaScript
blocks.place(ORANGE_CONCRETE, posCamera(0, 0, 5))Python
blocks.place(ORANGE_CONCRETE, pos_camera(0, 0, 5))Make two chat commands. One command creates a two-axis marker in the ground using relative coordinates. The other command will place a block of diamond at a distance of 5 blocks in front of the player. Have the player face toward the Northwest direction on the coordinate axes of polished andesite and place a diamond block.
JavaScript
player.onChat("twoaxis", function () {
for (let index = 0; index <= 16; index++) {
blocks.place(POLISHED_ANDESITE, pos(0, -1, index))
blocks.place(POLISHED_ANDESITE, pos(0, -1, -1 - index))
blocks.place(POLISHED_ANDESITE, pos(index , -1, 0))
blocks.place(POLISHED_ANDESITE, pos(-1 - index , -1, 0))
}
blocks.print(
"N",
YELLOW_CONCRETE,
pos(0, 3, -33),
EAST
)
blocks.print(
"W",
YELLOW_CONCRETE,
pos(-33, 3, 0),
NORTH
)
})
player.onChat("placeplayer", function () {
blocks.place(DIAMOND_BLOCK, posCamera(0, 0, 5))
})Python
def on_on_chat():
for index in range(17):
blocks.place(POLISHED_ANDESITE, pos(0, -1, index))
blocks.place(POLISHED_ANDESITE, pos(0, -1, -1 - index))
blocks.place(POLISHED_ANDESITE, pos(index, -1, 0))
blocks.place(POLISHED_ANDESITE, pos(-1 - index, -1, 0))
blocks.print("N", YELLOW_CONCRETE, pos(0, 3, -33), EAST)
blocks.print("W", YELLOW_CONCRETE, pos(-33, 3, 0), NORTH)
player.on_chat("twoaxis", on_on_chat)
def on_on_chat2():
blocks.place(DIAMOND_BLOCK, pos_camera(0, 0, 5))
player.on_chat("placeplayer", on_on_chat2)