www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Gatobot14 on September 15, 2015, 12:24:01 am

Title: Animation problems
Post by: Gatobot14 on September 15, 2015, 12:24:01 am
Ive make an object with 6 keyframe animation , 4 of them run fine but with the remaining 2 i got this exception
Code: [Select]
java.lang.ArrayIndexOutOfBoundsException: 131
at com.threed.jpct.Animation.interpolateLinear(Animation.java:752)
at com.threed.jpct.Animation.doAnimation(Animation.java:379)
at com.threed.jpct.Object3D.animate(Object3D.java:1494)

it happens when i call for the first time "object.animate(index, id);" where index=0 and id its a valid animation retrieve by "id=object.getAnimationSequence().getSequence("win");"

i really dont have clue, all animations have only 3 frames.

this happens with the 3 and 5 animation.
Title: Re: Animation problems
Post by: EgonOlsen on September 15, 2015, 07:34:22 am
Looks like as if the number of vertices in the keyframes don't match. You should get some log output about that. If that's the case, the reason might be that some vertices are collapsed by the importer. Try to use this to avoid this and see if it helps: http://www.jpct.net/doc/com/threed/jpct/Loader.html#setVertexOptimization(boolean) (http://www.jpct.net/doc/com/threed/jpct/Loader.html#setVertexOptimization(boolean))
Title: Re: Animation problems
Post by: Gatobot14 on September 15, 2015, 07:40:10 am
following a post from raft i use the method you suggest with false argument, in order to load the model, because i was having trouble from the loading and the log ouput you mention was showing,
but if you say its the vertices count i gues my model must have an error.
Title: Re: Animation problems
Post by: EgonOlsen on September 15, 2015, 07:42:34 am
Scan you log output. If that causes the problem, it should be printed out somewhere.
Title: Re: Animation problems
Post by: EgonOlsen on September 15, 2015, 07:44:31 am
BTW: To catch such problems earlier, it's a good idea to do a

Code: [Select]
Logger.setOnError(Logger.ON_ERROR_THROW_EXCEPTION);
early in your code. That's the default behaviour for jPCT-AE anyway. Desktop jPCT is more forgiving for compatibility reasons with older versions.
Title: Re: Animation problems
Post by: Gatobot14 on September 15, 2015, 06:29:56 pm
alright i will use that, but it was a error on the model  ::) some missing vertex.....