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

Inconsistent VRMSpringBoneColliderGroup scaling behaviour #673

Closed
emilianavt opened this issue Jan 14, 2021 · 4 comments
Closed

Inconsistent VRMSpringBoneColliderGroup scaling behaviour #673

emilianavt opened this issue Jan 14, 2021 · 4 comments
Milestone

Comments

@emilianavt
Copy link
Contributor

Describe the bug

The behaviour of the VRMSpringBoneColliderGroup does not seem to be consistent when first created in a game object with a scale not equal to 1, 1, 1. In the editor it scales along with object after setting it, even if this would lead to an inconsistent result (e.g. a collider in a 1, 1, 1 sphere with a radius of 0.5 shown to cover exact sphere). When exporting a scaled object with a collider on it, the radius of the collider seems to be divided by some component of the scale, even though it still shows the original value.

To Reproduce

  1. Take a basic VRoid VRM model
  2. Add a sphere to the Root bone
  3. Set the sphere's scale to 0.5, 0.5, 0.5
  4. Add a VRMSpringBoneColliderGroup
  5. Set the radius of the collider to 0.5
  6. Note that the purple sphere of the collider matches the sphere
    1. Optional:
    2. Use the scale tool to scale the sphere to 1, 1, 1
    3. Note that the collider gizmo still matches the sphere, while the collider radius is still 0.5
    4. Press Ctrl+Z to reset the scale to 0.5, 0.5, 0.5
  7. Export using UniVRM 0.63.2
  8. Import the file
  9. The sphere on the imported VRM has a scale of 1, 1, 1 and looks the same size as the 0.5, 0.5, 0.5 sphere, as expected
  10. The collider has a radius of 0.5, as expected
  11. The collider gizmo shows it to be twice as big as the visible sphere mesh, so the collider is actually as big as an unscaled 1 1, 1 sphere and collision tests confirm this

Expected behavior

The collider radius gives an absolute scale in world coordinates and is not influenced by the scaling of the object.

Screenshots

Original collider:
ColliderBeforeExport

Settings and gizmo after export:
ColliderAfterExport

Comparison of both:
ColliderAfterExportBoth

Comparison of both in play mode:
ColliderAfterExportPlayback

The sphere arcs on both models have spring bones set to collide with the collider.

Environments (please complete the following information):

  • OS: Windows 8.1
  • Unity version: Unity 2019.4.16f1
  • UniVRM version: 0.63.2
@ousttrue ousttrue added this to the v0.65 milestone Jan 18, 2021
@ousttrue ousttrue added the bug Something isn't working label Jan 18, 2021
@ousttrue ousttrue added feature request and removed bug Something isn't working labels Jan 25, 2021
@ousttrue ousttrue modified the milestones: v0.65, v0.66 Jan 25, 2021
@ousttrue
Copy link
Contributor

The current SpringBone are implemented so that all nodes can be exported in a normalized state.
It makes it easier to implement the exporter.
Please export (normalize) before setting the spring, then set the spring and export again.

In the future, we plan to fix it so that it works without normalization.

@emilianavt
Copy link
Contributor Author

For now, could a warning be added when exporting spring bone colliders without normalized nodes? I encountered this while investigating a report somebody made to me about colliders not working correctly.

ousttrue added a commit to ousttrue/UniVRM that referenced this issue Feb 2, 2021
@ousttrue
Copy link
Contributor

ousttrue commented Feb 3, 2021

Implemented support for SpringBone collider scaling during normalization.
Please try the next version v0.66.0.

@emilianavt
Copy link
Contributor Author

Thank you, the collider is now exported the way it is shown!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants