Try uncommenting the “bulletAppState.getPhysicsSpace().enableDebug(assetManager);” line, maybe it becomes apparent what the issue is.
I cant make a screenshot right now. Even without debuger if I look into the air I see a blue grid. It is the grid for the Model, moves with me. But I dont see the feets of my model or anything.
Well for some reason you apply the “shownormals” material to the model, any reason for that? I think you can just remove that line. Otherwise just make the model smaller (setScale) and attach it to a Node which you then attach the CharacterControl to so you can move the model in relation to the character control (setLocalTranslation on the model).
Another NullPointerException within these lines:
CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
player = new CharacterControl(capsuleShape, 0.05f);
player.setJumpSpeed(20);
player.setFallSpeed(30);
player.setGravity(30);
player.setPhysicsLocation(new Vector3f(10, 14, 120));
test.attachChild(model);
test.addControl(player);
model.addControl(player);
Im sorry man, im really tired, im checking back tomorrow, I have been working the whole night on getting this shitty Model working ^^
A NPE is the easiest exception to debug. Check the line number, one of the objects in that line is null (one of those you try to call a method on), find out which, find out why.
EDIT: Got it, declined the node bad. Do you have any free Model I can use to test it? Because my Model no is attached, but it only shows an grid, in my size, but I think the model is broken
Did you remove the material line I talked about?
Yea, it´s already removed. Want an updated Version of the Code?
Nah, I let you gain a bit more experience by experimenting ;p
Well it actually could be the model, I´ll look over the code again before trying this,but first i´ll get some rest. Are you answering tomorrow too? :3
Well open the j3o in the editor by double-clicking it and see how it looks (don’t forget to turn on the light in the editor).
It looks okay, a bit dark, but okay at all. Btw the light I attached to the model doesnt seems to work neither
The Model actually seems to be at the bottom of the player.
^----
I dont get it…
To figure out specifically what part you don’t get, are you deeply familiar with these concepts:
http://wiki.jmonkeyengine.org/doku.php/jme3:scenegraph_for_dummies
Tryed it, but it does not mention my problem, but thx ^^
It wasn’t about giving you a direct answer. It was about improving your understanding of the scene graph concept so that you could tell us which part of “add a child that is offset like you want” is confusing.
Don’t just skim it looking for an answer. Read it. Understand it. Then explain why adding a child with an offset from the parent is confusing because else we will just keep repeating the same advice in different arrangements.
I did understand that, and I tell you what is confusing. I createt A Spatial model, scaled it ((float) 0.4,(float) 1.8,(float) 0.4) and added a PointLight to it (to let it look like a flashlight or something, didnt work anyway). Then I created a CapsuleCollisionShape and a CharacterControl (player), using this CapsuleCollisionShape. I set the physics location of the"player" and set it´s preferences (speed etc.). I attached the player to the model using “model.addControl(player);”.
Then I attached the model to the rootNode and added
bulletAppState.getPhysicsSpace().add(model);
beneath it.
And I’ll play along… what’s the problem with that?