JavaIndexOutOfBondExceptions: -3 when setting Animation

Hello Sir, I have created 2 animations in blender and successfully imported in jme also. When i executed my code it also shows that i have 2 animation “Stand” and “Run” using this line(for (String anim : control.getAnimationNames()) { System.out.println(anim); }). Problem is that whenever my code executes this line “channel.setAnim(“Run”)” it gives “JavaIndexOutOfBondExceptions: -3” exception. Please help me why it is happening and how to fix it.

Below are the code which raises exception…
[control = model_player.getControl(AnimControl.class);
channel = control.createChannel();
channel.setAnim(“Run”);]

In blender my animation works fine. please help me.

please post the entire stacktrace.

1 Like

It is giving warning when i am exporting my model from blender. like
“Ogre limits a vertex to 4 bones”.

And also the same warning in jme when executing the code like.

WARNING: Vertex 1,961 has more than 4 weights per vertex! Ignoring…
Mar 08, 2014 11:05:56 PM com.jme3.scene.plugins.ogre.MeshLoader pushBoneAssign
WARNING: Vertex 1,961 has more than 4 weights per vertex! Ignoring…
Mar 08, 2014 11:05:56 PM com.jme3.scene.plugins.ogre.MeshLoader pushBoneAssign
WARNING: Vertex 1,962 has more than 4 weights per vertex! Ignoring…
Mar 08, 2014 11:05:56 PM com.jme3.scene.plugins.ogre.MeshLoader pushBoneAssign
WARNING: Vertex 1,962 has more than 4 weights per vertex! Ignoring…
Mar 08, 2014 11:05:56 PM com.jme3.scene.plugins.ogre.MeshLoader pushBoneAssign

I think because of this warning i am getting “ArrrayOutOfBoundException: -3”. But how to get rid of this warning in blender. I am not expert in blender so please tell me how to fix it.

----->

@jayfella said:
please post the entire stacktrace.
<-----

The warning is normal with certain models and probably not related to the exception.

As @jayfella said, we REALLY need to see the entire stack trace. Unless you’d rather debug this on your own.

Thanks for all your replies. I have deleted all vertex group assigned to the bone and reassigned manually for all bones. Now I am not getting warning “Ogre limits a vertex to 4 bones” and same in jme also.

But still it is showing “ArrayOutOfBoundException: -3” exception. Below are my full stack trace. please help me how to fix it.

run:
Mar 09, 2014 3:08:34 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(…) returned error code 5.
Mar 09, 2014 3:08:36 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.0.5
Mar 09, 2014 3:08:36 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Lwjgl 2.9.0 context running on thread LWJGL Renderer Thread
Mar 09, 2014 3:08:36 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Adapter: igdumdim64
Mar 09, 2014 3:08:36 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Driver Version: 9.18.10.3055
Mar 09, 2014 3:08:36 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Vendor: Intel
Mar 09, 2014 3:08:36 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: OpenGL Version: 4.0.0 - Build 9.18.10.3055
Mar 09, 2014 3:08:36 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Renderer: Intel® HD Graphics 4000
Mar 09, 2014 3:08:36 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: GLSL Ver: 4.00 - Build 9.18.10.3055
Mar 09, 2014 3:08:36 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
Mar 09, 2014 3:08:36 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Device: OpenAL Soft
Mar 09, 2014 3:08:36 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Vendor: OpenAL Community
Mar 09, 2014 3:08:36 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Renderer: OpenAL Soft
Mar 09, 2014 3:08:36 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Version: 1.1 ALSOFT 1.15.1
Mar 09, 2014 3:08:36 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: AudioRenderer supports 64 channels
Mar 09, 2014 3:08:36 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio effect extension version: 1.0
Mar 09, 2014 3:08:36 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio max auxilary sends: 4
-----------------> 1 in init
-----------------> 2 in init
inside model init
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: alpha_to_coverage
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: colour_write
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: depth_check
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: depth_func
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: depth_write
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: illumination_stage
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: light_clip_planes
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: light_scissor
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: normalise_normals
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: polygon_mode
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: scene_blend_op
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: shading
Mar 09, 2014 3:08:36 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: transparent_sorting
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: scale
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: colour_op
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: scale
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: colour_op
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: scale
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: colour_op
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: alpha_to_coverage
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: colour_write
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: depth_check
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: depth_func
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: depth_write
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: illumination_stage
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: light_clip_planes
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: light_scissor
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: normalise_normals
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: polygon_mode
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: scene_blend_op
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: shading
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readPassStatement
WARNING: Unsupported pass directive: transparent_sorting
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: scale
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: colour_op
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: scale
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: colour_op
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: scale
Mar 09, 2014 3:08:37 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: colour_op
Mar 09, 2014 3:08:38 PM com.jme3.scene.plugins.ogre.MeshLoader startElement
WARNING: Unknown tag: poses. Ignoring.

first anim:
RunNew.001

Mar 09, 2014 3:08:40 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.ArrayIndexOutOfBoundsException: -3
at com.jme3.animation.CompactVector3Array.deserialize(CompactVector3Array.java:95)
at com.jme3.animation.CompactVector3Array.deserialize(CompactVector3Array.java:42)
at com.jme3.animation.CompactArray.get(CompactArray.java:132)
at com.jme3.animation.BoneTrack.setTime(BoneTrack.java:232)
at com.jme3.animation.Animation.setTime(Animation.java:110)
at com.jme3.animation.AnimChannel.update(AnimChannel.java:395)
at com.jme3.animation.AnimControl.controlUpdate(AnimControl.java:332)
at com.jme3.scene.control.AbstractControl.update(AbstractControl.java:112)
at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:570)
at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:688)
at com.jme3.scene.Node.updateLogicalState(Node.java:145)
at com.jme3.scene.Node.updateLogicalState(Node.java:152)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:244)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)

BUILD SUCCESSFUL (total time: 8 seconds)

HELLO!

I want to check something on the side for you, while they are diagnosing your stack trace.

If its not to much to ask: can you tell me if you can run the animations in the SceneExplorer? Does that return any errors?

Well I am also not able to run animation in sceneExplorer too, It is giving same error. The same thread i found here (http://hub.jmonkeyengine.org/forum/topic/error-while-trying-to-animate-model/) also. I tried to fix this way also but no help. One person also mentioned the fix for this issue mentioned below.

"I found what the issue was:

An exported Ogre skeleton with animations has to have translation information on EVERY FRAME.

The ogre exporter I used just deleted translation information if it was x=0, y=0, z=0, causing this error.

To fix it just add to the animation:

<translate x=”0″ y=”0″ z=”0″ />

On every frame that doesn’t have translation.

In notepad++ I do it like this:

Find: >
<rotate

Replace: >
<translate x=”0″ y=”0″ z=”0″ />
<rotate

Now it’s working! "

I also tried this way and modified my xml file but it gives error while executing the code. Don’t know why every time one new problem arises after exporting model from blender.

I believe I’ve had this problem before as well, I verified it by comparing a working exported XML mesh+skeleton to one outputted by the newer ogre exports. (an 8 vertex box with 2 bone skeleton)

Seems its a case of JME not liking a certain XML format that one of the newer versions of ogre exporter puts out.

I went about it the lazy way and just put in a side install of blender 2.63 and loading up the included ogre exporter from JME.

Good thing blender 2.69 is already bundled with JME, as the few upgrades it has, made it my go to version. (although it feels backwards since the exporter included… only seems to work for 2.63).

Editing the XML works too, but you didn’t include what type of error, its also way too tricky, if you miss something, it stays broke.

1 Like

Thank you very much sir, As you mentioned i did the same and it got fixed. I downloaded blender 2.63 and installed it, also I downloaded blender2Ogre for blender 2.63 and after exporting it is working fine. So blender 2.69 is not compatible for jme?. In 2.69 i was getting only one file for skeleton (model.skeleton.xml) but in 2.63 i got 2 files for skeleton (model.skeleton.xml and model.skeleton). I opened the second one but didn’t get anything readable. Once again thanks.

1 Like