vrm-c / vrm-specification

vrm specification
235 stars 37 forks source link

rewrite LookAt #386

Closed ousttrue closed 2 years ago

ousttrue commented 2 years ago

fixed #384

ousttrue commented 2 years ago

既存実装について

https://github.com/vrm-c/UniVRM/blob/master/Assets/VRM/Runtime/LookAt/Matrix4x4Extensions.cs#L25

yaw x pitch => EulerYXZ ぽい。

https://docs.unity3d.com/ja/2020.3/ScriptReference/Quaternion.Euler.html

Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis; applied in that order.

つまり列ベクトル表記で EulerY EuleryX EulerZ v という意味になるので EulerYXZ である。たぶん。 EulerYXZ はわりとポピュラーであり無ければ RotateYAxis RotateXAxis RoateZAxis で作ればいいです。

Euler YXZ order でよろしかろうという感じ。 LookAt では Z(roll)は常に0で扱うので実質 EulerYX

ousttrue commented 2 years ago

指摘を取り入れて CalcYawPitch 関数を修正しました @0b5vr

ousttrue commented 2 years ago

視線値は、LookAt空間 での 上下左右 の Degree 値です。

という言い方に変えました。 これで、 lookAt の更新完了です。

よろしくお願いします。 @0b5vr