Models without Materials

so i’m currently working on a simple RPG for a project development class and using JME3, i found a model im wanting to use online that’s a .obj file, but i can’t load it cause i keep getting the “.mtl file for model not found” error everytime it starts up. i’ve tried using a default material like what was used to show the teapot normally but it still doesn’t work.



[java]private void createCharacter() {

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

character = new CharacterControl(capsule, 0.01f);

Spatial model = assetManager.loadModel(“Models/Zack.obj”);

Material mat = new Material(assetManager, “Common/MatDefs/Misc/ShowNormals.j3md”);

model.setMaterial(mat);

model.scale(0.05f,0.06f,0.05f);

model.rotate(0.0f,-3.0f,0.0f);

player = new CharacterControl(capsule, 0.05f);

player.setJumpSpeed(15);

player.setFallSpeed(20);

player.setGravity(50);

//model.setLocalScale(0.5f);

model.addControl(character);

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

rootNode.attachChild(model);

getPhysicsSpace().add(character);

getPhysicsSpace().add(player);

}

[/java]

this is my code to add the character to the program, any help?

If you open your obj file using notepad then you can see theres a line something like:

mtllib NameOfYourFile.mtl

If that file does not exsist, then thats the problem.

If that LINE of code doesn’t exsist, then you should probebly remove the line:

usemtl Material

aswell. Its found near the bottom.



Not an expert at this but it would be my guess that some of the problems mentioned is the problem your having.

i opened the file like you said and found the mtllib right near the top, so should i delete that and just use the model as i would one without a material?

If you have the mtl file with the exact name as the line says in the same folder as your obj file you shouldn’t have to do anything.

when i downloaded the model though it didn’t come with a .mtl file, just the .obj file

Then remove that line and this:

usemtl Material

And if that doesnt work then remove

s off

Not sure what it does tho, but it might has something to do with something.