Skip to content

[SpringBoneLimit] SpringBone LimitSpace gizmo#2721

Merged
ousttrue merged 8 commits into
vrm-c:masterfrom
ousttrue:springlimit_gizmo
Sep 16, 2025
Merged

[SpringBoneLimit] SpringBone LimitSpace gizmo#2721
ousttrue merged 8 commits into
vrm-c:masterfrom
ousttrue:springlimit_gizmo

Conversation

@ousttrue

@ousttrue ousttrue commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

limit_sph

SpringBoneLimit 拡張の続きです。
この PR では、関連するカスタムエディターを実装しました。
SpringBone のロジック間違い(角度制限の効き方が gizmo の見た目と一致していないような)などは後の PR で改めてやります。
gizmo と custom editor のみに注目。

@ousttrue ousttrue added this to the nextnext milestone Sep 8, 2025
@ousttrue ousttrue changed the title [SpringBoneLimit] Springlimit gizmo [SpringBoneLimit] SpringBone LimitSpace gizmo Sep 9, 2025
@ousttrue

ousttrue commented Sep 9, 2025

Copy link
Copy Markdown
Contributor Author

World - JointLocal - SpringBoneLimitLocal という空間が入れ子になっていて、SpringBoneLimitLocal を可視化している。
この空間は、原点が SpringBone 区間の Head, Y 軸の1 がTail 位置であると考える。
xz は Quaternion.FromTo((0,1,0), tail) で算出された結果を使い、Hinge, Spherecal の角度制限をする軸となる。
SpringBoneLimitLocal には Quaternion で任意の回転 offset を設定できる。
この空間の Y軸に沿って Cone, Hinge, Spherecal ? の gizmo を描画する。

vrm-c/vrm-specification#496

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a custom editor with gizmo visualization for SpringBone limit constraints in VRM 1.0. The changes focus on adding visual gizmos to display angle limit constraints for different types (Cone, Hinge, Spherical) in the Scene view.

  • Adds gizmo rendering for SpringBone angle limits with visual representations of constraint boundaries
  • Enhances the FindJoint method to return joint index information needed for proper gizmo positioning
  • Implements interactive rotation handles for adjusting angle limit rotations in the Scene view

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Vrm10InstanceSpringBone.cs Updates FindJoint method to return joint index for better editor integration
VRM10SpringBoneJointEditor.cs Implements comprehensive gizmo system with constraint visualization and interactive handles

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@notargs notargs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2点、可読性観点でコメントしました 🙇

Handles.DrawLine(Vector3.zero, new Vector3(0, c, s) * limit_tail_pos.magnitude);
Handles.DrawLine(Vector3.zero, new Vector3(0, c, -s) * limit_tail_pos.magnitude);
Handles.DrawLine(Vector3.zero, new Vector3(s, c, 0) * limit_tail_pos.magnitude);
Handles.DrawLine(Vector3.zero, new Vector3(-s, c, 0) * limit_tail_pos.magnitude);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

少しネストが深く可読性に改善の余地があるかも。
DrawConeGizmo() 関数などの粒度で別クラスに切り分けてあげることができそう

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

DrawConeGizmo() の引数のデザインに関してなんか良い案ありますか。
たぶん再利用されないと思うのだけど。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

再利用するかどうかはともかく、「再利用性の高い」コードスニペットにはなりそうです

Undo.RecordObject(target, "m_angleLimitRotation");
// serializedObject.Update();
// m_angleLimitRotation.quaternionValue = rot;
// serializedObject.ApplyModifiedProperties();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不要なコメントアウトは削除するか、コメントアウトした理由を書いておくとDeadCodeになるのを防ぐことができそう

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

コメント削除。OnSceneGui では serializedObject にアクセスできない。

@ousttrue ousttrue requested a review from notargs September 12, 2025 04:55

@notargs notargs left a comment

Copy link
Copy Markdown
Contributor

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 618478f into vrm-c:master Sep 16, 2025
1 check passed
@ousttrue ousttrue deleted the springlimit_gizmo branch September 16, 2025 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants