minor bug fix

This commit is contained in:
左右看
2023-07-25 22:54:47 +08:00
parent 48b1bfda00
commit 82d747395a
2 changed files with 15 additions and 3 deletions
@@ -541,10 +541,10 @@ namespace Gallop.Live.Cutt
if(nextKey != null && nextKey.interpolateType != LiveCameraInterpolateType.None)
{
float ratio = CalculateInterpolationValue(curKey, nextKey, time * 60);
chara.transform.position = Vector3.Slerp(curKey.Position, nextKey.Position, ratio);
chara.transform.position = Vector3.Lerp(curKey.Position, nextKey.Position, ratio);
var x = chara.Position.localEulerAngles.x;
var z = chara.Position.localEulerAngles.z;
chara.Position.localEulerAngles = Vector3.Slerp(new Vector3(x, curKey.LocalRotationY, z), new Vector3(x, nextKey.LocalRotationY, z), ratio);
chara.Position.localEulerAngles = new Vector3(x, Mathf.Lerp(curKey.LocalRotationY, nextKey.LocalRotationY, ratio), z);
}
else
{
@@ -36,6 +36,8 @@ namespace Gallop.Live.Cutt
private int _curIndex = -1;
private int _prevIndex = -1;
public int charaIndex = -1;
public void Initialize(Transform target, int targetIndex, int seqDataIndex, LiveTimelineControl timelineControl, List<AnimationClip> animclips = null)
{
if(animclips != null)
@@ -53,6 +55,8 @@ namespace Gallop.Live.Cutt
_tempTarget = target;
_targetIndex = targetIndex;
charaIndex = targetIndex;
_keyArray = timelineControl._keyArray;
if (seqDataIndex < _keyArray.Length)
@@ -109,7 +113,15 @@ namespace Gallop.Live.Cutt
LiveTimelineKeyCharaMotionData arg = curKey.key as LiveTimelineKeyCharaMotionData;
AnimationClip anim = arg.clip;
double start = (double)arg.motionHeadFrame / 60;
double start;
if(arg.isMotionHeadFrameAll)
{
start = (double)arg.motionHeadFrame / 60;
}
else
{
start = (double)arg.motionHeadFrameSeparetes[charaIndex] / 60;
}
double interval = currentTime - (double)arg.frame / 60;
_tempAnim[anim.name].time = (float)(start + interval);