Replacing Oto with Ninja, how would I do this?

i know alot of forum mods hate when beginners ask questions that should be explained in the tutorials, but even after looking through them I can’t find what all I need to do to replace the Oto model with the Ninja.



This is from TestWalkingChar (main):

private void createCharacter() {

CapsuleCollisionShape capsule = new CapsuleCollisionShape(3f, 4f);

character = new CharacterControl(capsule, 0.01f);

model = (Node) assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);

//model.setLocalScale(0.5f);

model.addControl(character);

character.setPhysicsLocation(new Vector3f(-140, 15, -10));

rootNode.attachChild(model);

getPhysicsSpace().add(character);

}



When I replace the Oto stuff with Ninja’s, I get this:



SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IndexOutOfBoundsException: bitIndex < 0: -1

at java.util.BitSet.set(BitSet.java:262)

at com.jme3.animation.AnimChannel.addBone(AnimChannel.java:271)

at mygame.Main.setupAnimationController(Main.java:299)

at mygame.Main.simpleInitApp(Main.java:137)…



it looks like I have to change up the bone stuff, and I also don’t get what these lines at the bottom are for:



private void setupAnimationController() {

animationControl = model.getControl(AnimControl.class);

animationControl.addListener(this);

animationChannel = animationControl.createChannel();

shootingChannel = animationControl.createChannel();

shootingChannel.addBone(animationControl.getSkeleton().getBone(“uparm.right”));

shootingChannel.addBone(animationControl.getSkeleton().getBone(“arm.right”));

shootingChannel.addBone(animationControl.getSkeleton().getBone(“hand.right”));



maybe shootingchannel is what is called when you shoot the bomb in the test? i got rid of it because it made the project crash.



i dont know what else to say, any criticism will be helpful too

you also need to change the animation handling “stuff” it’s crashing because the bones being referenced and I imagine the animations dont match across the two models

I’m a beginner too. However i think that you have to master all the hello tutorials before trying to understand TestWalkingCharacter.

And i’m sure that you haven’t seen the doc page before asking because , for example, there is this simple tutorial that explain to you what are the lines about AnimationController.



This is an advice, not a critique :slight_smile:

2 Likes