Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LookAt の整理 #2138

Merged
merged 5 commits into from
Aug 18, 2023
Merged

LookAt の整理 #2138

merged 5 commits into from
Aug 18, 2023

Conversation

ousttrue
Copy link
Contributor

LookAtInput を導入して、LookAt を整理。

@@ -51,46 +51,46 @@ public Vector3 ExternalForce
}
}

public Vrm10Runtime(Vrm10Instance target, bool useControlRig)
public Vrm10Runtime(Vrm10Instance instance, bool useControlRig)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target が LookAt target と紛らわしいような気がしたので、名前変更。

@@ -229,10 +214,37 @@ public void Process()
}

// 4. Gaze control
LookAt.Process(m_target.LookAtTargetType, m_target.LookAtTarget);
LookAtInput lookAtInput = default;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VrmAnimation により LookAt の入力が、
VrmAnimation, Transform 追跡SetYawPitch の三択 になりました。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

さらに変更。
Transform 追跡AutoBlink 的な感じ。

@@ -8,5 +9,6 @@ public interface IVrm10Animation : IDisposable
(INormalizedPoseProvider, ITPoseProvider) ControlRig { get; }
IReadOnlyDictionary<ExpressionKey, Func<float>> ExpressionMap { get; }
public void ShowBoxMan(bool enable);
LookAtInput? LookAt { get; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VrmAnimation から LookAt を供給する。まだ入れ物だけ

@ousttrue ousttrue requested a review from Santarh August 18, 2023 07:02
/// 入力値。適宜更新可。
/// </summary>
public LookAtInput LookAtInput { get; private set; }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LookAtInput を入力、 EyeDirection を出力とした。

Santarh
Santarh previously approved these changes Aug 18, 2023
Copy link
Contributor

@Santarh Santarh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

よさそう

}

/// <summary>
/// Yaw/Pitch 値を直接設定します。
/// LookAtTargetTypes が SpecifiedTransform の場合、ここで設定しても値は上書きされます。
/// Vrm10Instance.LookAtTargetTypes が SpecifiedTransform の場合、ここで設定しても値は上書きされます。
/// </summary>
/// <param name="yaw">Headボーンのforwardに対するyaw角(度)</param>
/// <param name="pitch">Headボーンのforwardに対するpitch角(度)</param>
public void SetYawPitchManually(float yaw, float pitch)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetYawPitchManually() は存続

Comment on lines +16 to 24
/// <summary>
/// 入力値。適宜更新可。
/// </summary>
public LookAtInput LookAtInput { get; set; }

/// <summary>
/// 出力値。Process() のみが更新する
/// </summary>
public LookAtEyeDirection EyeDirection { get; private set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vrm10RuntimeLookAt

  • LookAtInput という「LookAt する対象」をユーザ入力として
  • それを Process() で処理し
  • LookAtEyeDirection という「実際に Bone や BlendShape といった ILookAtEyeDirectionApplicable が適用すべき LookAt の状態」を出力する

システムになる。

左目と右目の独立はまたの機会に・・・
/// NOTE: 何故か使われていない
/// Pitch of RightEye
/// </summary>
public float RightPitch { get; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今の段階では左右の目の YawPitch を区別する必要はない。

将来的にも規格レベルで解決するべきハードルが高いので、またいずれ……
参考:vrm-c/vrm-specification#177

Copy link
Contributor

@Santarh Santarh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ousttrue ousttrue merged commit 70f101d into vrm-c:master Aug 18, 2023
@ousttrue ousttrue deleted the fix/refactor_lookat branch January 24, 2024 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants