V-Sekai / godot-vrm

Importer/Exporter for VRM avatars and MToon shader. Available for Godot 4.1+ and 3.2+ in the Asset Library.
https://godotengine.org/asset-library/asset/2031
Other
287 stars 24 forks source link

Implementing Spring Bones in SkeletonModifier #108

Closed rolevax closed 1 month ago

rolevax commented 1 month ago

Godot 4.3 added Skeleton Modifier to make modifications applied to skeletons managed in a clear order.

Currently our spring bone does not work together with skeleton modifier. The modifier creates temporary modifications that cannot be read from other part of code. For example, if I use a skeleton modifier to implement LookAt rotating the head, the hairs controlled by spring bones will remain in its previous position and do not follow the head since it only reads values before the modification.

Skeleton modifier looks like a good place to implement spring bones, and by doing that the application order of spring bone and other modifiers can also be easily edited.

fire commented 1 month ago

We'll have a chat.godotengine.org meeting with the animation and some xr team members tomorrow in the #animation channel in rocketchat.

You are invited to discuss.

fire commented 1 month ago

We migrated bone node constraints to use SkeletonModifier3D, but not yet the spring bones system.

https://github.com/V-Sekai/godot-vrm/commit/770d808a794081e2f5650787f0842e594868f79a

lyuma commented 1 month ago

We already migrated Spring Bones (vrm_secondary.gd) to use the SkeletonModifier3D a few months ago. The code I changed today also does this for BoneNodeConstraintApplier.

I have not yet released this change to the asset library, but I plan to.

Also, a note since it might explain the confusion in the implementation: The way these modifiers were done, we use conventional Node scripts at the top-level, and those add a SkeletonModifier3D child of the Skeleton3D (with the internal flag set, so they will not be saved). This was the only way I could figure out how to implement this without breaking compat with 4.2 and earlier.

lyuma commented 1 month ago

I welcome feedback on how to do this better. Which branch or version of godot-vrm were you using when filing this issue? Can you try the latest git version and see if it solves the issue?

If it is solved, should we close the issue? If it is not solved on the latest git version, I need feedback on what exactly you are doing that is not working correctly.

fire commented 1 month ago

Closing. Feel free to update us and we can reopen.