3D関連

function egg:3d/motion_from_rotation

storage egg:3d/motion_from_rotation <<**rotation** 入力 Rotation データ [float,float]
storage egg:3d/motion_from_rotation >>**motion** 出力 Motion データ [double,double,double]
return 出力 処理成否 0 = 処理失敗

Rotation データから Motion データを取得します。

Rotation データと Motion データはNBTデータタグの Rotation, Motion に相当します。

取得される Motion データは単位ベクトル(1tickでの移動量が1m)になります。

移動量の調整は function egg:3d/scale_motion を利用してください。

https://gist.github.com/ricerabbitalk-enderman/786a5fe2eff767c2ee7dca0d12512673

function egg:3d/rotation_from_motion

storage egg:3d/motion_from_rotation <<**motion** 入力 Rotation データ Motion データ
storage egg:3d/motion_from_rotation >>**rotation** 出力 Motion データ Rotation データ
return 出力 処理成否 処理成否

Motion データから Rotation データを取得します。

Rotation データと Motion データはNBTデータタグの Rotation, Motion に相当します。

内部的に固定小数点での演算を行っているため、精度の関係上極端な Motion データ ([320,-0.001,30]のような数値差の大きいもの)ではそれなりに精度が落ちます。

Motion データは 16 以内の移動量に収めることを推奨します。

# 引数設定.
data modify storage egg:3d/rotation_from_motion <<motion set from entity @s Motion
# 呼び出し.
function egg:3d/rotation_from_motion
# 結果取得.
data modify entity @s Rotation set from storage egg:3d/rotation_from_motion >>rotation