Object model is not shown

Hi … I’m new to this forum and i’m not native english speaker. So, please go easy on me, Grammar Nazis.

I just started using JME and i merely know basics to Java.

So… My problem… I made model in Blender and imported it to JME successfully. I can view my model in sceneComposer and everything is OK. But if i try to dynamically add my model, it doesn’t appear.

I used code from TestBetterCharacter.java file and did everything exactly like it was there and my model just didn’t show up :c. I tried lots of different things to make my model show and i even tried using little Jaime.j3o for my project. Nothing works.

Can somebody help me please? I have wasted too much time on that.

Ask, if code is needed

Most likely lighting problem. But yeah post some code

This is my code… i tried lighting and it also didn’t work and i had lighting made in scene composer before

private void initPlayer() {
        

        //Create node for player 
        mainPlayer = new Node("MainPlayer");
        
        //Add location to player
        mainPlayer.setLocalTranslation(-80, 15, 20);
        
        //Create character controll to node for rotation and so we can
        //add other things to character
        physicsChar = new BetterCharacterControl(1, 6, 6);
        mainPlayer.addControl(physicsChar);
        
        //Add physics to character in scene space
        bulletAppState.getPhysicsSpace().add(physicsChar);
        
        Node playerModel = (Node)assetManager.loadModel("Models/Character/Character.j3o");
        playerModel.setLocalScale(10000f);
       
        
        
        //playerModel.setLocalScale(1.5f);
        mainPlayer.attachChild(playerModel);
        
        System.out.println(playerModel.getWorldTranslation());
        
        //Just added this...
        PointLight myLight = new PointLight();
        rootNode.addLight(myLight);
        LightControl lightControl = new LightControl(myLight);
        mainPlayer.addControl(lightControl); // this spatial controls the position of this light.
        ///...to this and it didn't work
        
        //Add node with physics to the scene
        rootNode.attachChild(mainPlayer);
        
        
       
    }

So much scaling! Have you tried not scaling it at all?
Or perhaps

AmbientLight al = new AmbientLight();
playerModel.addLight(al);

Maybe that will show it.

Honestly I don’t know, I’d need you to upload the Character.j3o so I can try myself

Lol… i forgot to adjust scaling back again when i tried “everything”.

This is model i borrowed… i’m not using it commercially.

I added animations to it

http://www.upload.ee/files/4508728/steve.rar.html

Try to place him at 0,0,0 and the usual scale. Where is your camera looking at? Maybe you are simply not facing it?

Also try SetMaterial() to overwrite them with a wireframe. If it’s visible in wireframe, then you have a lighting Problem.

Also, does it work without the controls and physics? (character falling through the ground)

1 Like

Ok, so I removed some stuff from your code and added a line

private void initPlayer() 
    {
        Node mainPlayer = new Node("MainPlayer");


        BetterCharacterControl physicsChar = new BetterCharacterControl(1, 6, 6);
        mainPlayer.addControl(physicsChar);

        bulletAppState.getPhysicsSpace().add(physicsChar);

        Node playerModel = (Node)assetManager.loadModel("Models/Character/Character.j3o");



        mainPlayer.attachChild(playerModel);


        AmbientLight al2 = new AmbientLight();
        mainPlayer.addLight(al2);
        //playerModel.addLight(al2);

        //Add node with physics to the scene
        rootNode.attachChild(mainPlayer);
        bulletAppState.setDebugEnabled(true);
    }

The character appears and is lit by the ambient light I added. There were 2 problems

  1. You made him miles away with the translation
  2. He is a physics object, he immediatly falls! Gravity takes him away.

bulletAppState.setDebugEnabled(true); —> This line should make it much easier for you to see were he is.

For me the above code works, but remember he is very large and the camera may start inside of him, so try looking down

1 Like

i have setDebugEnabled always true .

Dude … i dont know what u did, but i also got it running . Probably most of my testing was done with scaled model.
Location is okay. i need player to be in that location.

Thank you, Man :smile: