How do I lower my model that I replaced in the TestWalkingChar test?

I replaced Oto with Ninja and he is floating inside the collision shape. I posted two threads about this but I had trouble understanding the kind people who told me how it’s done since I lack basic javascript knowledge. If I were to get this little problem worked out, I would be really relieved. I was told to create a node and addControl the model to it. This is what my createCharacter() looks like



[java] private void createCharacter() {



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

character = new CharacterControl(capsule, 0.01f);

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

model.setLocalScale(0.03f);

model.addControl(character);

character.setPhysicsLocation(new Vector3f(0, 10, 0));

rootNode.attachChild(model);

getPhysicsSpace().add(character);

bulletAppState.getPhysicsSpace().enableDebug(assetManager);





}[/java]



this is what i think would bring it down on the y axis onto the ground



[java] private void createCharacter() {



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

character = new CharacterControl(capsule, 0.01f);

Node n = new Node();

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

model.setLocalScale(0.03f);

model.addControl(n);

n.setLocalTranslation(0, -20, 0)

n.addControl(character);

character.setPhysicsLocation(new Vector3f(0, 10, 0));

rootNode.attachChild(model);

getPhysicsSpace().add(character);

bulletAppState.getPhysicsSpace().enableDebug(assetManager);





}[/java]



i have read over a few tutorials that cover this but its still screwy

To be honest, I suggest to first get some basic java knowledge, if you confuse javascript with java it is currently … not so good.

1 Like

Yes, despite the similarity in names Javascript and Java are very different things…