My model is too high inside the collision shape, how to make a node to move him down?

i still cant figure out how to create a node as users suggested in http://hub.jmonkeyengine.org/groups/general-2/forum/topic/my-ninja-character-is-floating-after-i-replaced-oto-with-him. i know i need to create a node in cheateCharacter() but i dont know where to put it, how to structure it, or where else to like make an instance of it or something.



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);

Node n = new Node();

n.attachChild(model);

model.getLocalTranslation().subtractLocal(0f,.05f,0f);

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

rootNode.attachChild(model);

getPhysicsSpace().add(character);

bulletAppState.getPhysicsSpace().enableDebug(assetManager);



}



i have been directed to the tutorials and other resources but i still cant figure this out

you are using getLocalTranslation().set() (or subtractLocal specifically) which is wrong, use setLocalTranslation if you want to set a translation on an object.

would it be something like model.setLocalTranslation(0, -5, 0);

you are attaching the model to the rootNode, attach it to the new node you created, instead of:

[java]rootNode.attachChild(model);[/java]



attach the model to the node like this:

[java]n.attachChild(model);[/java]



Instead of:

[java]model.addControl(character);[/java]



use



[java]n.addControl(character);[/java]





Please study this carefully 10000 times:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies

i did what wezrule suggested and i cannot see the floor, and i havent added the setLocalTranslation (by the way would i add it to the model, n, or character?)



this is what my createCharacter() looks like,



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

character = new CharacterControl(capsule, 0.01f);

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

model.setLocalScale(0.03f);

Node n = new Node();

n.attachChild(model);

n.addControl(character);

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

rootNode.attachChild(model); (isn’t it neccessary to add add it to rootNode, as wezrule said “instead of” like to replace)

getPhysicsSpace().add(character);

bulletAppState.getPhysicsSpace().enableDebug(assetManager);



one more thing, how important is the order of lines? im sure it just depends on what is modified or whatever but are out of place lines a common screwup?

@snigglesnock said:
how important is the order of lines? im sure it just depends on what is modified or whatever but are out of place lines a common screwup?

:brainsout:

i actually expected something like that lol

Each line means something and if it doesn’t mean anything to you that line of code shouldn’t be in your application. Write applications that don’t need that code or try to understand what the code does.

To put this question in another context: “How important is the order of sentences in a book? Is it a common screwup for a book writer to mix up his sentences?” – The order of the sentences is important and its not common to screw that up, its rather the small bits like a misplaced “was” instead of “is” that also happen to book writers.

i understand, but since i dont know crap about java in general its difficult to decide where i put what people suggest

@snigglesnock said:
since i dont know crap about java in general its difficult to decide where i put what people suggest

You won't get far with jME3 anyway then, either you learn java or you should use lightweight scripting environments like the popular FPS mods.

ive heard its possible for non-programmers to use jme3, so ill keep trying to get it working.

@snigglesnock said:
ive heard its possible for non-programmers to use jme3

Not really, no.