public AnimationChannelTarget(AnimationChannelTarget channelTarget, GLTFRoot gltfRoot) : base(channelTarget) { if (channelTarget == null) { return; } Node = new NodeId(channelTarget.Node, gltfRoot); Path = channelTarget.Path; }
public Vector3[] Corrector(AnimationClip animationClip, string propertyName, List <EditorCurveBinding> curveBindings, int frameCount, string curveBindingGroupPath, out GLTFAnimationChannelPath path) { if (!Enable) { path = GLTFAnimationChannelPath.translation; return(null); } if (curveBindingGroupPath != _dealtWithCurveBindingsPath) { path = GLTFAnimationChannelPath.translation; return(null); } switch (propertyName) { case "m_LocalPosition": { var data = new Vector3[frameCount]; for (var i = 0; i < frameCount; ++i) { var time = i / animationClip.frameRate; Vector3 frameData = Vector3.zero; GetPostionInWorldSpace(time, animationClip, curveBindings, _dealtWithBoneParentCurveBindings, ref frameData); Vector3 left = Vector3.zero; Vector3 right = Vector3.zero; GetPostionInWorldSpace(time, animationClip, _leftFootCurveBindings, _leftFootParentCurveBindings, ref left); GetPostionInWorldSpace(time, animationClip, _rightFootCurveBindings, _rightFootParentCurveBindings, ref right); Vector3 newPoint = (left + right) / 2.0f; Vector3 offset = newPoint - _initialPoint; offset = new Vector3(DisableXZMovement ? offset.x : 0.0f, DisableYMovement ? offset.y : 0.0f, DisableXZMovement ? offset.z : 0.0f); var corrFrameData = frameData - offset; GetPostionInParentSpace(time, animationClip, curveBindings, _dealtWithBoneParentCurveBindings, ref corrFrameData); data[i] = corrFrameData; } path = GLTFAnimationChannelPath.translation; return(data); } case "m_LocalRotation": { path = GLTFAnimationChannelPath.rotation; return(null); } case "m_LocalScale": { path = GLTFAnimationChannelPath.scale; return(null); } case "localEulerAnglesRaw": { throw new Exception("Parsing of localEulerAnglesRaw is not supported."); } } Debug.LogError("Unrecognized property name: " + propertyName); path = GLTFAnimationChannelPath.translation; return(null); }