You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environments (please complete the following information):
UniVRM version: 0.121.0
Unity version: Unity-2023.2.0b8
OS: Windows 11
Describe the bug
Hi,
I'm having problems with the springs on an imported VRM1.0 file.
The process in which I'm doing it is two-fold.
Load the model, and store it, disabled, in the scene, inside a "modelCache" parent
At a later time (user-initiated) the model is duplicated, the copy made visible and placed in the scene.
From the first step, the model appears to be loading fine. Not disabling it and just letting it show, and it works fine.
However, when using Instantiate to create a copy, the springs appear to be causing the hair to go up violently.
This does not occur on VRM0 files that have been migrated, a VRM0 file seems to duplicate correctly.
A basic example of it failing is
private async void Start() {
var instanceTask = Vrm10.LoadPathAsync(filename,
awaitCaller: new RuntimeOnlyAwaitCaller()
);
while (!instanceTask.IsCompleted)
{
await Awaitable.EndOfFrameAsync();
}
var instance = instanceTask.Result;
instance.gameObject.SetActive(false);
var duplicate = Instantiate(instance.gameObject);
duplicate.SetActive(true);
}
As it's loading correctly in the first instance, I am wondering if there's any other procedures I need to follow after creating a duplicate of the loaded VRM? Any re-initialisation that isn't performed when just copy it?
Things I've tried, but didn't work
Not disabling the cached version, it loads fine, the duplicate still doesn't work correctly
Calling ReconstructSpringBone in multiple places after both the cached version and copy are created
I have downloaded the code and run some more tests on it
When creating the initial "cached" version, it adds a RuntimeGltfInstance
When copying, the Vrm10Runtime constructor uses the gltfInstance to determine "m_defaultTransformStates" (lines 76-89: Vrm10Runtime.cs)
However, the gltfInstance.InitialTransformStates is empty.
Hacking the code a little, if I force it to reinitialise the states from the model instead, the duplicated instance works correctly.
Putting a check if the gltfInstance.InitialTransformStates actually has something in there, if not it'll build them from the object as though the gltfInstance is null.
negatron99
changed the title
Duplicated VRM1 springbones not working correctly
Instantiate() on existing VRM does not create InitialTransformStates correctly
May 15, 2024
Environments (please complete the following information):
0.121.0
Unity-2023.2.0b8
Windows 11
Describe the bug
Hi,
I'm having problems with the springs on an imported VRM1.0 file.
The process in which I'm doing it is two-fold.
From the first step, the model appears to be loading fine. Not disabling it and just letting it show, and it works fine.
However, when using Instantiate to create a copy, the springs appear to be causing the hair to go up violently.
This does not occur on VRM0 files that have been migrated, a VRM0 file seems to duplicate correctly.
A basic example of it failing is
As it's loading correctly in the first instance, I am wondering if there's any other procedures I need to follow after creating a duplicate of the loaded VRM? Any re-initialisation that isn't performed when just copy it?
Things I've tried, but didn't work
Edit:
There are warnings in the console
lots of warnings of the same type.
The text was updated successfully, but these errors were encountered: