座標からX・Y・Zの値を取り出す Position.getValue
ひとことで言うと
指定した座標の値を取得します(x、y または z)。
ブロックとコード
○のX座標
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
pos(0, 0, 0).getValue(Axis.X)pos(0, 0, 0).get_value(Axis.X)引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| direction | Axis | 座標の値を返す軸 |
使用例
Display the player's current altitude in the game chat. The altitude is the y coordinate of the player's current world position.
JavaScript
player.say("My current altitude is: " + player.position().getValue(Axis.Y));Python
player.say("My current altitude is: " + str(player.position().get_value(Axis.Y)))