www.jpct.net

Bones - Skeletal and Pose Animations for jPCT/jPCT-AE => Bones => Topic started by: cefengxu on December 10, 2015, 10:11:00 am

Title: [resolved] changing animation via interaction
Post by: cefengxu on December 10, 2015, 10:11:00 am
hi raft :

i want to implement a feature .
when i touch the object with loop animation-1 , the object must have some respond ( do  another animation-2 ) , and then come back to the original animation-1 after the animation-2 is finished.

how to do that ? i know how to change the animation with model using :
group.animateSkin(index, animationID);

but i do not know how to handle the time of the animation, or does Bones have some simple ways to deal with it ??
Title: Re: [resolving] changing animation via interaction
Post by: raft on December 10, 2015, 02:07:30 pm
there is no automated mechanism for that but you can easily implement one.

you can query the time of a skin animation via SkinClip. (each animation is represented by a SkinClip)

Code: [Select]
AnimatedGroup/Animated3D.getSkinClipSequence().getClip(index).getTime()
here index is zero based so according to your sample, essentially :

Code: [Select]
index = animationID - 1;
Title: Re: [resolving] changing animation via interaction
Post by: cefengxu on December 11, 2015, 04:36:02 am
thanks you ,but seem not so convenient ~~  it work . thanks again raft