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

[1.0] The tail joint of SpringBone cannot be imported when hitRadius is not set #1441

Closed
0b5vr opened this issue Dec 23, 2021 · 4 comments
Closed
Labels
1.0 bug Something isn't working importer
Milestone

Comments

@0b5vr
Copy link
Contributor

0b5vr commented Dec 23, 2021

環境情報

  • UniVRM version: 0.92.0
  • Unity version: Unity-2019.4
  • OS: Windows 10

バグについて

  • バグの内容

SpringBoneの仕様上、末端JointにはhitRadius等のオプショナルな値は無くても良いことになっていたはずですが、無いと動かないようです。
恐らくhitRadiusだけでなく、他の値も同等の問題を発生させると思います。

  • ConsoleLog
InvalidOperationException: Nullable object must have a value.
System.Nullable`1[T].get_Value () (at <9577ac7a62ef43179789031239ba8798>:0)
UniVRM10.Vrm10Importer+<LoadSpringBoneAsync>d__17.MoveNext () (at Library/PackageCache/com.vrmc.vrm@2487dd5fdd/Runtime/IO/Vrm10Importer.cs:578)

該当行:

joint.m_jointRadius = gltfJoint.HitRadius.Value;

  • エラーの発生するファイル(ここに貼り付けても差し支えの無いもの)

three-vrm-girl-1.0-beta.zip

VRM1.0-beta版のthree-vrm-girlです。

@0b5vr 0b5vr added bug Something isn't working 1.0 labels Dec 23, 2021
@0b5vr
Copy link
Contributor Author

0b5vr commented Dec 23, 2021

シンプルに、該当箇所をこうすれば解決するものと思います:

if (!(gltfJoint.HitRadius is null)) {
    joint.m_jointRadius = gltfJoint.HitRadius.Value;
}
if (!(gltfJoint.DragForce is null)) {
    joint.m_dragForce = gltfJoint.DragForce.Value;
}
if (!(gltfJoint.GravityDir is null)) {
    joint.m_gravityDir = Vector3InvertX(gltfJoint.GravityDir);
}
if (!(gltfJoint.GravityPower is null)) {
    joint.m_gravityPower = gltfJoint.GravityPower.Value;
}
if (!(gltfJoint.Stiffness is null)) {
    joint.m_stiffnessForce = gltfJoint.Stiffness.Value;
}

C#に不慣れなもので、もしより良いsyntaxがあればご教示ください。
このままで良ければ、これでPR作ってしまいます。

一点気がかりなのは、末端ノードでないノードをこの方針で処理してしまってよいかは気になります。
もしかしたら、末端ノードの場合のみ上記のパラメタ群を処理しない、という方針にしたほうがより正しいかも……

@ousttrue
Copy link
Contributor

ousttrue commented Dec 27, 2021

報告ありがとうございます。
非末端は、警告にしてエラーにはしない方向でやってみます。

@ousttrue
Copy link
Contributor

https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_springBone-1.0-beta/schema/VRMC_springBone.joint.schema.json
に基づいて、愚直にデフォルト値を割り当てることにしました。
問題があってから対応しようと思います。

@ousttrue
Copy link
Contributor

v0.93.0 年始予定です。

@ousttrue ousttrue closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 bug Something isn't working importer
Projects
None yet
Development

No branches or pull requests

2 participants