【发布时间】:2019-08-05 20:39:16
【问题描述】:
骨骼动画问题(始终使用 AnimationAction.play() 在(循环)动画中播放默认 T 姿势(关键帧 0))。 使用 FBXLoader 从带有骨架和动画的 .FBX 文件导入动画。
我已经修剪了 AnimationClip.tracks array() 以删除第一个关键帧,但它在动画期间一直包含基本关键帧 0 T-pose。
我尝试清空 AnimationClip.tracks 数组。如果我随后 play() 关联的 AnimationAction,它仍然会设置一些姿势,这表明问题可能根本不在于 AnimationClip,而在于父 Action/Mixer。
我还尝试使用“startAt(0.0333..)”来抵消 AnimationAction。但它仍然在 play() 期间添加了基本姿势。
//setup mixer for object
scene.mixer = new THREE.AnimationMixer( scene.obj );
// actions array (quick reference)
scene.actions = [];
for (i in scene.obj.animations) {
scene.actions.push(scene.mixer.clipAction(scene.obj.animations[ i ] ));
// offset keyframe 0 (doesnt work since it still uses the keyframe 0 "T-pose" when the animation has finished playing and optionally loops)
scene.actions[i].startAt(0.0334);
// tried trimming with subClip fn, but again it'll throw in the T-pose.
subClip(scene.actions[3].getClip(), 0.03333333432674409 /* 30 fps: skip first frame @ 0.03333333432674408 */, 2);
// emptying the tracks array also doesnt work, since its still setting bones when I play/stop the AnimationAction.
scene.actions[3].getClip().tracks = [];
scene.actions[3].getClip().resetDuration();
}
function subClip(clip, start, end) {
for (i in clip.tracks) {
var track = clip.tracks[i];
// (we depend on internal behaviour of trim() which uses Array.slice,
// and doesn't modify the original array).
clip.tracks[i].trim(start, end);
// Once trim has been called, our track now has its own copies of
// times/values, and no shared data. It's now safe to modify in-place,
// which shift() does.
clip.tracks[i].shift(-start);
}
// after modifying (key)frames, reset duration to new length
clip.resetDuration();
}
我希望在动画期间不使用任何关键帧 0 数据。特别是在循环中:他们很明显的口吃。 (因为位置跳跃+下一个姿势的奇怪插值)。
【问题讨论】:
标签: animation three.js trim clip