クリックしたブロックの面の方向を取得したい

クリックしたブロックの面の方向を取得したいです。 5x5x1掘れるツールを作ろうとしています。掘るときの面の方向によって掘れる方向を変えたいです。 アドバイスお願いします。
14 Replies
あお🦀
あお🦀2mo ago
面と言うよりはプレイヤーの向いている方向で判別した方がいい気がします 東西南北とプレイヤーのpitchで上下判別
ゆきあ
ゆきあ2mo ago
コメントありがとうございます。向いている方向から判別するのは簡易でいいですね。 できれば、同じ方向からでも、面指定で別方向に掘削できればいいのですが・・・
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
確かこれ使えたと思います https://skripthub.net/docs/?id=947
Skript Hub - Documentation
Facing (Expression) - Skript
The facing of an entity or block, i.e. exactly north, south, east, west, up or down (unlike direction which is the exact direction, e.g. '0.5 south and 0.7 east')
ゆきあ
ゆきあ2mo ago
ありがとうございます。プレイヤーの向いている方向を取得することはできるんですが、クリックした面の方向を取得する方法は難しいですか?
unnnnnnnnnnn
unnnnnnnnnnn2mo ago
じごくさんのレイトレースが参考になりそう https://discord.com/channels/545926404785569793/1146072606664052836/1146405407326208080
ゆきあ
ゆきあ2mo ago
コメントありがとうございます。 どういう構文になるんでしょう?追加プラグインは必要ですか?
___
___2mo ago
Skriptのみ
on right click:
clicked block is set
set {_dest} to location of clicked block
set {_src} to eye location of player
set {_lv} to vector from yaw (yaw of player) and pitch (pitch of player)
set {_result::*} to intercept({_src}, {_lv}, {_dest}, 1, 1)
if is_hit({_result::*}):
set {_hitPosition} to get_hit_position({_result::*})
on right click:
clicked block is set
set {_dest} to location of clicked block
set {_src} to eye location of player
set {_lv} to vector from yaw (yaw of player) and pitch (pitch of player)
set {_result::*} to intercept({_src}, {_lv}, {_dest}, 1, 1)
if is_hit({_result::*}):
set {_hitPosition} to get_hit_position({_result::*})
ヒット位置のy座標とブロック中心との角度から6面を識別する
ゆきあ
ゆきあ2mo ago
返信ありがとうございます。 このソースで試してみると、interceptの部分とis_hitの部分でエラー出ます・・・ これファンクションでしょうか。もうちょっと調べてみます・・・。
___
___2mo ago
clicked blockがnullでない時点でinterceptは必ずヒット位置返すからis_hit必要なかった
___
___2mo ago
東西南北の4つの方向は側面のヒット位置とブロック中心の角度から分岐 上と下は底面のヒット位置のyが整数になることを利用する
No description
___
___2mo ago
あとコメント読みましょう
ゆきあ
ゆきあ2mo ago
ありがとうございます。やってみます。
Want results from more Discord servers?
Add your server