0
\$\begingroup\$

I've been having an issue for months now where if I have a dynamic bone chain that splits off in any way (ie. any of the chain's bones have child gameobjects), then the flow of the dynamic bone chain becomes completely disconnected and seems to do something akin to ignoring weight painting. This is hard to explain through text, so I've linked images of before and after I added a child gameobject to one of the bones in a dynamic bone chain.

Behavior without gameobject interrupting Dynamic Bone Chain: Behavior without gameobject interrupting Dynamic Bone Chain

Behavior WITH gameobject under one bone in the Dynamic Bone Chain: Behavior WITH gameobject under one bone in the Dynamic Bone Chain

This is the block of settings I have available to edit with my existing Dynamic Bone script: enter image description here

This model is intended to be imported as a functional "Hand Puppet" avatar into VRchat, therefore any major project-side changes to the Unity physics engine will not be carried over in-game. VRchat has blacklisted most scripts for their game with the exceptions of Rigidbodies/Fixed Joints, Constraints, Dynamic Bones, Audio Sources, and some limited functions of Final IK.

As a brief explanation, the reason there are two white lines signifying Dynamic Bone behavior in my screenshots is that I have applied Dynamic Bone roots to two bones on the model's skeleton so that their behavior compounds to create a more fluid and natural motion (at the cost of some performance). My posted concern occurs no matter how many/few dynamic bone components are applied as long as there is at least one component on the chain.

I'm using Unity 2018.4.20f1.

I have tried countless methods involving constraints, Blender work, revised armatures, updating dynamic bones, etc, but this issue persists no matter what.

How can I fix this problem?

\$\endgroup\$
2
  • \$\begingroup\$ Just curious, go to unity project’s physics settings and change the solver type from Projected Gauss-Siedel to Temporal Gauss-Siedel. I believe i know what your problem is, but I am curious if the new physx solver is able to overcome this issue. Though you are using an old version of unity and it may not have this feature. Any particular reason you are using such an old version of unity? \$\endgroup\$ – Jon Jan 22 at 9:38
  • \$\begingroup\$ @Jon I'm using the older version of unity specifically because this model is going to be imported into VRchat, which only supports that specific version of unity. I also can't use alternative scripts or components specifically because VRC has blacklisted pretty much all alternatives. Also this version of unity doesn't seem to have that physics feature. \$\endgroup\$ – Will Bouhuys Jan 22 at 17:18
0
\$\begingroup\$

So I believe the problem here is an interesting form of the age old mass-ratio constraint problem. I’ll explain the high level.

The why:

So Unity’s default MLCP solver is commonly referred to as PGS for short. In this (and any) physics solver, a constraint between two objects uses the mass and inertia tensor (referred to as mass properties) of both objects as inputs to determine the impulse required to move both objects such that the constraint’s conditions are satisfied.

In the case of the constraints you’re using, the condition they are satisfying is a fixed distance between the two objects, meaning that the solver will apply corrective impulses every frame, on every constraint, for a set amount of iterations. The amount of iterations the solver uses to attempt to converge on a solution is just an estimate, which means that there can be situations in which the constraint will diverge, especially if a large mass is being carried by a series of smaller masses (i.e. wrecking ball on a chain). The constraints between the smaller masses have no knowledge of the larger mass way at the end of the chain, so they cannot adequately compensate for the effective mass of the large object on the end. I believe a similar situation is occurring here.

TL;DR I believe that the mass of your new child object is not accounted for by the constraints which bind the parent object to the rest of the body, making those constraints unable to converge on a solution. If that is the case, I think there are a few ways to fix this. First, being to disable physics on the child object while it is parented. If not that, you could try making the mass of the child extremely small and removing linear drag from the child as well. It may take a bit parameter tuning and testing to achieve an acceptable solution, and this is a very common practice.

That’s my best guess from the limited information in the question

Edit: Other tests/solutions could include parenting the child object to the leading object in this chain. If this fixes the problem, then I would consider my theory correct. Another route would be to try significantly raising the masses of every object in the chain such that the mass of the new child object is negligible in comparison to any segment, though, this may introduce other undesirable behavior as the entire object would have significantly more momentum.

Another similar (albeit far less likely) theory to explain your problem would be that the engine decided to recalculate the polyhedral mass properties when the child was parented to your object, including mass, center of mass and inertia tensor. That would effectively make that segment a compound collider. The shift in center of mass plus the mass ratio problem could explain the behavior. This would be a bit more difficult to fix and diagnose, though. If that was the case, you may need to manually modify those mass properties when parenting and unparenting so that it appears to the physics engine as if nothing has changed.

\$\endgroup\$
3
  • \$\begingroup\$ this sounds like an incredibly in-depth explanation, and I'm intrigued by how this functions, I didn't know it was this detailed! That being said, if you do want/need any further information on this project/scene, I would be more than happy to provide anything necessary for proper diagnosing of the issue \$\endgroup\$ – Will Bouhuys Jan 22 at 22:59
  • \$\begingroup\$ @WillBouhuys I mentioned many of the possible fixes under the tl;dr section. \$\endgroup\$ – Jon Jan 23 at 3:13
  • \$\begingroup\$ Unfortunately I don't believe any of your solutions will be applicable in my situation. When importing assets as avatars into VRchat (the intended function of this project) there are heavy limitations on what I can do. For instance, any project-side physics changes will not carry over in-game, so I'm realistically limited to settings within the Dynamic Bone script itself unless this is an intended physics behavior in my current version of Unity. For clarification, I've added a screenshot of my available Dynamic Bone settings to the original post. \$\endgroup\$ – Will Bouhuys Jan 23 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.