executeコマンドを使って幾何学的操作をする分野です。
点A :Aの居る座標のこと
面A :Aの居る座標を通りAの視線と直交する平面のこと
直線A :Aの居る座標を通りAの視線と平行な直線のこと
線分AB:Aの居る座標とBの居る座標を結ぶ線のこと
・垂線
点Aから直線Bへの垂線
execute as A at @s
rotated as B positioned ^ ^ ^2000
facing entity B feet positioned ^ ^ ^2000
run command
点Aから面Bへの垂線
execute as A at B
positioned ^ ^ ^2000
facing entity @s feet positioned ^ ^ ^2000
run command
・内分/外分
線分ABの1:2の内分点
execute as A at @s
facing entity B feet
run tp @s ~ ~ ~ ~ ~
execute as A at @s
facing ^1 ^ ^ positioned ^ ^ ^3000
facing entity B feet positioned ^ ^ ^1000
rotated as @s facing ^-1 ^ ^ positioned ^ ^ ^2000
run command
線分ABの3:1の外分点
execute as A at @s
facing entity B feet
run tp @s ~ ~ ~ ~ ~
execute as A at @s
facing ^1 ^ ^ positioned ^ ^ ^2000
facing entity B feet positioned ^ ^ ^3000
rotated as @s facing ^-1 ^ ^ positioned ^ ^ ^1000
run command
・交点
線Aと線Bの交点
線Aと線Bが交点を持つことが分かっていることが必要
1.点Aから線Bへの垂線を2倍した位置に点Cを設置
2.点Aを交点向き、点Cを点Aとは反対向きに向かせる
3.二分探索を用いて交点を求める
tag A add Cross
execute positioned as A as B rotated as @s
positioned ^ ^ ^1000 facing entity @s feet
positioned ^ ^ ^1000 rotated as @s
positioned ^ ^ ^1000 facing entity @e[tag=A,limit=1] feet
positioned ^ ^ ^-1000 rotated as @s
positioned ^ ^ ^-2000
run summon minecraft:area_effect_cloud ~ ~ ~ {Particle:"minecraft:block minecraft:air",Radius:0.1f,Tags:[C,Cross]}
execute as A at @s
positioned ^ ^ ^2000
as C unless entity @s[distance=..2000]
as A at @s facing ^ ^ ^-1
run tp @s ~ ~ ~ ~ ~
execute as C at @s
rotated as A facing ^ ^ ^-1
run tp @s ~ ~ ~ ~ ~
execute as @e[tag=TestA,limit=1] at @s positioned ^ ^ ^327.68
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^163.84
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^81.92
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^40.96
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^20.48
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^10.24
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^5.12
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^2.56
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^1.28
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^0.64
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^0.32
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^0.16
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^0.08
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^0.04
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^0.02
rotated as @e[tag=Cross,sort=nearest,limit=1] positioned ^ ^ ^0.01
run particle minecraft:heart ~ ~ ~ 0 0 0 0 1 force
kill C
tag A remove Cross
・外積
編集中
・円
線分PQを直径とした点Xによる円
直径を長辺に取る円周角は90度→垂線コマンドの応用
execute as X at P
facing entity Q feet facing ^ ^1 ^ positioned ^ ^ ^2000
rotated as @s positioned ^ ^ ^10
facing entity P feet positioned ^ ^ ^2000
rotated as @s positioned ^ ^ ^-10
facing entity P feet positioned as P
positioned ^ ^ ^2000
facing entity Q feet positioned ^ ^ ^2000
rotated as @s run tp @s ~ ~ ~ ~11 0
・平行移動
AをBの視線方向に10m平行移動
execute as A at @s rotated as B run tp @s ^ ^ ^10
・拡大/縮小
・反転(鏡像変換)
点Aを面Bに対して対称な位置に移動
※点Aから面Bへの垂線の足Hをとり、線分AHの2:1の外分点をとる
execute as A at B
positioned ^ ^ ^2000
facing entity @s feet positioned ^ ^ ^2000
rotated as B facing ^1 ^ ^ positioned ^ ^ ^1000
facing entity @s feet positioned ^ ^ ^-1000
rotated as B facing ^-1 ^ ^ positioned ^ ^ ^2000
run tp @s ~ ~ ~
・視線検知
視線先のエンティティにTargetというタグが付く
tag @p add Watcher
execute positioned ^ ^ ^10.1 as @e[distance=..10]
positioned as @s positioned ^ ^ ^1000
facing entity @a[tag=Watcher,limit=1] eyes positioned ^ ^ ^1000
positioned ~-0.5 ~-0.5 ~-0.5 if entity @s[dx=0,dy=0,dz=0]
run tag @s add Target
tag @p remove Watcher
コメント
最新を表示する
視線検知のやつってホントにTargetタグがつくんですか? tag addじゃなくてglowingですし、何なら最後のコマンドでタグ消えませんか?
そのままでは動きません。
A,B,P,Q,Xと言った部分には、何らかのエンティティを指定するセレクタを入れます。
平行移動のコマンドでAにあたる部分は例えば何にすればいいかなどを書いてほしいです。
これってそのまま入力したらなんらかのコマンド作動するんですか
NG表示方式
NGID一覧