Hi, I tried more than 100 times to split an animation, I has been search on the forum I saw another people ask the same but maybe these solutions are obsolet.
I wrote this code, in order to get an Array that store all animations but it doesnt work because I dont know how to get frames correctly.
// Animation to split
const animationClip = asset.resource.data.animation;
var duration = animationClip.duration;
var fps = 60;
var animClips = [];
var animations = ut.CharFrames; // this is an array that have frame ranges
animations.forEach( anim => {
var startTime = anim.startFrame/ fps;
var endTime = anim.endFrame/ fps;
const duration = endTime - startTime;
const newTrack = new pc.AnimTrack();
newTrack._name = anim.name;
newTrack._duration = duration;
newTrack._curves = animationClip._curves;
newTrack._inputs = animationClip.inputs;
newTrack._outputs = animationClip.outputs;
// Add the clip to the anim component
animClips.push(newTrack);
});
I saw that the “inputs” have the frame length of my animation but when I print it to the console I see that it only has 2 values.