public void OnSkinnedMeshUpdate(SkinnedMeshRenderedVertex vertex)
        {
            try
            {
                if (!this.enabled || !this.gameObject)
                {
                    return;
                }

                gameObject.transform.localPosition    = Vector3.zero;
                gameObject.transform.localEulerAngles = Vector3.zero;

                gameObject.transform.position = vertex.position;
                //      gameObject.transform.eulerAngles = gameObject.transform.TransformDirection(gameObject.transform.parent.InverseTransformDirection(gameObject.transform.parent.eulerAngles));
            }
            catch (Exception skinnedMeshUpdateErr)
            {
#if DEBUG
                Log.LogError($"Error in Adv Parent Late Update: {skinnedMeshUpdateErr.Message}\n{skinnedMeshUpdateErr.StackTrace}");
#endif
            }
        }
        private void DoUpdate()
        {
            try
            {
                if (!gameObject || !gameObject.activeInHierarchy)
                {
                    return;
                }

                bool updated = false;
                if (BlendShapesDirty() || NeedsTimeUpdate())
                {
                    skinnedMeshRenderer.BakeMesh(bakedMesh);

                    bakedMesh.GetVertices(vertexList);
                    //             bakedMesh.GetNormals(normalList);

                    updated        = true;
                    lastUpdateTime = Time.time;
                }

                foreach (int vertexId in SkinnedMeshRendererListeners.Keys)
                {
                    List <SkinnedMeshUpdateFrame> frameList = frameSet[vertexId];
                    Vector3 verticeLocation = vertexList[vertexId];
                    //             Vector3 normalDirection = normalList[vertexId];

                    SkinnedMeshRenderedVertex vertex;
                    if (!RenderAlways)
                    {
                        vertex = new SkinnedMeshRenderedVertex(transform.TransformPoint(verticeLocation), Vector3.zero, verticeLocation, Vector3.zero);
                    }
                    else if (updated)
                    {
                        frameList.Add(new SkinnedMeshUpdateFrame(verticeLocation, Time.time, Vector3.zero));
                        if (frameList.Count > 1)
                        {
                            frameList[frameList.Count - 2] = new SkinnedMeshUpdateFrame(frameList[frameList.Count - 2].position, frameList[frameList.Count - 2].time, (frameList[frameList.Count - 1].position - frameList[frameList.Count - 2].position) / (frameList[frameList.Count - 1].time - frameList[frameList.Count - 2].time));
                        }
                        while (frameList.Count > FrameHistoryCount)
                        {
                            frameList.RemoveAt(0);
                        }

                        vertex = new SkinnedMeshRenderedVertex(transform.TransformPoint(verticeLocation), Vector3.zero, verticeLocation, Vector3.zero);
                        //                SkinnedMeshRenderedVertex vertex = new SkinnedMeshRenderedVertex(transform.TransformPoint(verticeLocation), transform.TransformDirection(normalDirection), verticeLocation, normalDirection);
                    }
                    else
                    {
                        // Extrapolation time
                        Vector3 extrapolatedMovement = AverageDelta(frameList);
                        Vector3 predictedPosition    = frameList[frameList.Count - 1].position + (extrapolatedMovement * (Time.time - frameList[frameList.Count - 1].time));
                        vertex = new SkinnedMeshRenderedVertex(transform.TransformPoint(predictedPosition), Vector3.zero, predictedPosition, Vector3.zero);
                    }

                    foreach (Action <SkinnedMeshRenderedVertex> listener in SkinnedMeshRendererListeners[vertexId])
                    {
                        listener.Invoke(vertex);
                    }
                }
            }
            catch (Exception e)
            {
                Log.LogWarning($"Error in accessory computation: {e.Message}\n{e.StackTrace}");
            }
        }