[SpringBoneLimit] SpringBone LimitSpace gizmo#2721
Conversation
|
World - JointLocal - SpringBoneLimitLocal という空間が入れ子になっていて、SpringBoneLimitLocal を可視化している。 |
There was a problem hiding this comment.
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.
| 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); |
There was a problem hiding this comment.
少しネストが深く可読性に改善の余地があるかも。
DrawConeGizmo() 関数などの粒度で別クラスに切り分けてあげることができそう
There was a problem hiding this comment.
DrawConeGizmo() の引数のデザインに関してなんか良い案ありますか。
たぶん再利用されないと思うのだけど。
There was a problem hiding this comment.
再利用するかどうかはともかく、「再利用性の高い」コードスニペットにはなりそうです
| Undo.RecordObject(target, "m_angleLimitRotation"); | ||
| // serializedObject.Update(); | ||
| // m_angleLimitRotation.quaternionValue = rot; | ||
| // serializedObject.ApplyModifiedProperties(); |
There was a problem hiding this comment.
不要なコメントアウトは削除するか、コメントアウトした理由を書いておくとDeadCodeになるのを防ぐことができそう
There was a problem hiding this comment.
コメント削除。OnSceneGui では serializedObject にアクセスできない。
SpringBoneLimit 拡張の続きです。
この PR では、関連するカスタムエディターを実装しました。
SpringBone のロジック間違い(角度制限の効き方が gizmo の見た目と一致していないような)などは後の PR で改めてやります。
gizmo と custom editor のみに注目。