UnityJigglePhysics icon indicating copy to clipboard operation
UnityJigglePhysics copied to clipboard

invalid input position

Open ihopeitdoes opened this issue 1 year ago • 5 comments

Hi, I'm trying to add jiggle physics as mod for a model in an existing game. It works for certain models, but one in particular has very small local positions on the bone transforms which I think is causing issues. For example:

transform.position assign attempt for 'DEF-breast.R' is not valid. Input position is { NaN, NaN, NaN }. UnityEngine.Transform:set_position (UnityEngine.Vector3) JigglePhysics.JiggleBone:PoseBone (single) (at Assets/JigglePhysics/Scripts/JiggleBone.cs:318) JigglePhysics.JiggleRigBuilder/JiggleRig:Pose (bool) (at Assets/JigglePhysics/Scripts/JiggleRigBuilder.cs:109) JigglePhysics.JiggleRigBuilder:Advance (single) (at Assets/JigglePhysics/Scripts/JiggleRigBuilder.cs:229) JigglePhysics.JiggleRigBuilder:LateUpdate () (at Assets/JigglePhysics/Scripts/JiggleRigBuilder.cs:247)

the position signal current and previous position when logged look something like previousFrame: (7.126597E-05, 0.01273373, -0.0007695098) currentFrame: (7.126597E-05, 0.01273373, -0.0007695098)" I'm going to assume there's not much that can be done about it as the system doesn't support values as small as that. (apart from trying to extract the model from the game into blender then applying transforms there)

ihopeitdoes avatar Jun 26 '24 20:06 ihopeitdoes

If two bones in the hierarchy are perfectly on top of one another, that would cause a divide by zero. Do you mind sharing the model so I can test?

naelstrof avatar Jun 26 '24 20:06 naelstrof

If two bones in the hierarchy are perfectly on top of one another, that would cause a divide by zero. Do you mind sharing the model so I can test?

sure but it's nsfw though hopefully that's ok [Removed]

JiggleRigBuilder was attached to it with a jiggle rig with a target of the bone "rig/root/torso/MCH-spine.002/MCH-spine.003/tweak_spine.003/ORG-spine.003/ORG-breast.R/DEF-breast.R" with a random breast jiggle setting from the examples folder.

ihopeitdoes avatar Jun 26 '24 22:06 ihopeitdoes

I wasn't able to replicate the NaN issue. I'll need more information. Which version of UnityJigglePhysics are you using?

naelstrof avatar Jun 27 '24 00:06 naelstrof

The model you provided had a few configuration issues. It required 100x scaling, was offset from origin, and has many animation rig bones that aren't supposed to be exported. I didn't check but I believe the hierarchy was non-humanoid as well. There's a chance that fixing those configuration problems first might fix your issues with the floating point numbers.

naelstrof avatar Jun 27 '24 00:06 naelstrof

The model you provided had a few configuration issues. It required 100x scaling, was offset from origin, and has many animation rig bones that aren't supposed to be exported. I didn't check but I believe the hierarchy was non-humanoid as well. There's a chance that fixing those configuration problems first might fix your issues with the floating point numbers.

yeah the model is setup in a pretty weird way by the original devs.

I wasn't able to replicate the NaN issue. I'll need more information. Which version of UnityJigglePhysics are you using?

The master branch version but I've just realized that latest release is far behind master so I'm using that now and and I don't get the error any more.There was some weird flickering going so I check the bone positions like you said. DEF-breast.R and ORG-breast.R are indeed on top of each other so I moved one slightly in front of the other and it stopped so I guess your suspicion was right. Might be worth documenting somewhere. Thanks for your help and the awesome tool.

ihopeitdoes avatar Jun 27 '24 09:06 ihopeitdoes