ValveSoftware / steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
BSD 3-Clause "New" or "Revised" License
1.03k stars 255 forks source link

Using the Skeleton Poser infinitely generates render model instances #625

Open najmm01 opened 4 years ago

najmm01 commented 4 years ago

A weird bug started popping out of nowhere in our project, even though everything worked fine before. Now, whenever I add a new Skeleton Poser and create a new pose, the render models keep on generating without stop and the custom inspector for the poser component gets all messed up.

Also, I get the following error in the console when this happens:

IndexOutOfRangeException: Index was outside the bounds of the array. Valve.VR.SteamVR_Skeleton_PoserEditor.DeepCopyPose (Valve.VR.SteamVR_Skeleton_Pose source, Valve.VR.SteamVR_Skeleton_Pose dest) (at Assets/SteamVR/Input/Editor/SteamVR_Skeleton_PoserEditor.cs:398) Valve.VR.SteamVR_Skeleton_PoserEditor.UpdatePreviewHand (UnityEditor.SerializedProperty instanceProperty, UnityEditor.SerializedProperty showPreviewProperty, UnityEngine.GameObject previewPrefab, Valve.VR.SteamVR_Skeleton_Pose_Hand handData, Valve.VR.SteamVR_Skeleton_Pose sourcePose, System.Boolean forceUpdate) (at Assets/SteamVR/Input/Editor/SteamVR_Skeleton_PoserEditor.cs:118) Valve.VR.SteamVR_Skeleton_PoserEditor.DrawPoseEditorMenu () (at Assets/SteamVR/Input/Editor/SteamVR_Skeleton_PoserEditor.cs:599) Valve.VR.SteamVR_Skeleton_PoserEditor.OnInspectorGUI () (at Assets/SteamVR/Input/Editor/SteamVR_Skeleton_PoserEditor.cs:442) UnityEditor.UIElements.InspectorElement+c_AnonStorey1.<>m_0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:501) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179) Jan 11, 2020

ZnelArts commented 4 years ago

I am observing this issue too, any workaround?

Im running Steam VR 2.5 and Unity 2019.3.14f1

solsnare commented 4 years ago

Line 411 SteamVR_Skeleton_Poser, the DeepCopyPose function have lines where they check if the pose rotations and positions are null, they AREN'T null, that's why it breaks. You need to put an additional check to see if the length == 0 and it should fix the problem.

I'm on an old version of SteamVR so I bet this doesn't exist in newer versions, if u have that option, do it.

solsnare commented 3 years ago

Why would it check if it's null AND has more than one? Its checking if it's null or length == 0

On Sat, Oct 31, 2020, 4:18 PM ZnelArts notifications@github.com wrote:

Line 411 SteamVR_Skeleton_Poser, the DeepCopyPose function have lines where they check if the pose rotations and positions are null, they AREN'T null, that's why it breaks. You need to put an additional check to see if the length == 0 and it should fix the problem.

I'm on an old version of SteamVR so I bet this doesn't exist in newer versions, if u have that option, do it.

Thanks, did as you suggested but the issue is still happening. if (dest.rightHand.bonePositions == null && dest.rightHand.bonePositions.Length > 0) dest.rightHand.bonePositions = new Vector3[boneNum]; if (dest.rightHand.boneRotations == null && dest.rightHand.boneRotations.Length > 0) dest.rightHand.boneRotations = new Quaternion[boneNum];

    if (dest.leftHand.bonePositions == null && dest.leftHand.bonePositions.Length > 0) dest.leftHand.bonePositions = new Vector3[boneNum];
    if (dest.leftHand.boneRotations == null && dest.leftHand.boneRotations.Length > 0) dest.leftHand.boneRotations = new Quaternion[boneNum];

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ValveSoftware/steamvr_unity_plugin/issues/625#issuecomment-719983219, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR7UCBTBC4PFVZOX7RD7XLSNRWK3ANCNFSM4KFQ6JGA .

ZnelArts commented 3 years ago

Why would it check if it's null AND has more than one? Its checking if it's null or length == 0 On Sat, Oct 31, 2020, 4:18 PM ZnelArts @.***> wrote: Line 411 SteamVR_Skeleton_Poser, the DeepCopyPose function have lines where they check if the pose rotations and positions are null, they AREN'T null, that's why it breaks. You need to put an additional check to see if the length == 0 and it should fix the problem. I'm on an old version of SteamVR so I bet this doesn't exist in newer versions, if u have that option, do it. Thanks, did as you suggested but the issue is still happening. if (dest.rightHand.bonePositions == null && dest.rightHand.bonePositions.Length > 0) dest.rightHand.bonePositions = new Vector3[boneNum]; if (dest.rightHand.boneRotations == null && dest.rightHand.boneRotations.Length > 0) dest.rightHand.boneRotations = new Quaternion[boneNum]; if (dest.leftHand.bonePositions == null && dest.leftHand.bonePositions.Length > 0) dest.leftHand.bonePositions = new Vector3[boneNum]; if (dest.leftHand.boneRotations == null && dest.leftHand.boneRotations.Length > 0) dest.leftHand.boneRotations = new Quaternion[boneNum]; — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#625 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR7UCBTBC4PFVZOX7RD7XLSNRWK3ANCNFSM4KFQ6JGA .

Sorry, figured out my logic was wrong and deleted the reply. But you are right, with your suggestion the issue is fixed. Thank you

ZnelArts commented 3 years ago

However even though we have a workaround, this is still a bug in Steam VR

NickJones13908 commented 3 years ago

Hi did you ever happen to work out the work around to this i have the exact same issue and im not sure how to implement the fix your talking about

many thanks