Everything is black :( Am I doing something wrong?

Hai!

I found a tutorial on how to make games with jME

and it showed a lil bit of the total code, the rest u had to do urself…

So I need help, cause I got a box, and a moving sphere including collision calculations.

But I can't see anything!



I'v tried set the cam to look at the box, but it's perfectly black :frowning:

Am I doing something wrong with my lighting or something?



Heres my very simple and complete code:

import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Sphere;

/**
 * Started Date: Jul 20, 2004<br><br>
 * Simple HelloWorld program for jME
 *
 * @author Jack Lindamood
 */
public class HelloWorld extends SimpleGame{
    public static Sphere ball;
    public static Box player1;
    public static int player1speed = 1;
    public static Vector3f ballVelocity = new Vector3f(1,0,0);
    public static int player2Score = 0;
    public static Box sideWalls;
    public static Box player1GoalWall;
   
    public static void main(String[] args) {
        HelloWorld app=new HelloWorld();    // Create Object
       
        app.setConfigShowMode(ConfigShowMode.AlwaysShow);

        ball = new Sphere("Ball", 8, 8, 2);
        ball.setModelBound(new BoundingSphere());
        ball.updateModelBound();
        player1 = new Box("Player1", new Vector3f(), 2, 5, 10);
        player1.setModelBound(new BoundingBox());
        player1.updateModelBound();
        player1.getLocalTranslation().set(-100, 0, 0);

        sideWalls = new Box("Wall", new Vector3f(), 2, 5, 10);
        sideWalls.setModelBound(new BoundingBox());
        sideWalls.updateModelBound();
        sideWalls.getLocalTranslation().set(-50, 0, 0);

        player1GoalWall = new Box("Wall", new Vector3f(), 2, 5, 10);
        player1GoalWall.setModelBound(new BoundingBox());
        player1GoalWall.updateModelBound();
        player1GoalWall.getLocalTranslation().set(0, 0, 0);

        // Signal to show properties dialog
       
        app.start();    // Start the program
    }

    @Override
    protected void simpleUpdate(){
        if (KeyBindingManager.getKeyBindingManager().isValidCommand("MoveUp",true)){
            player1.getLocalTranslation().z -= player1speed * timer.getTimePerFrame();
        }
        if (KeyBindingManager.getKeyBindingManager().isValidCommand("MoveDown",true)){
            player1.getLocalTranslation().z += player1speed * timer.getTimePerFrame();
        }

        if (player1.hasCollision(ball, false)) {
        ballVelocity.x *= -1f;
        }
        if (sideWalls.hasCollision(ball, false)) {
        ballVelocity.z *= -1f;
        }
        if (player1GoalWall.hasCollision(ball, false)) {
        player2Score++;
        }

    }


    protected void simpleInitGame() {
        display.setTitle("Game");
        KeyBindingManager.getKeyBindingManager().set("MoveUp", KeyInput.KEY_W);
        KeyBindingManager.getKeyBindingManager().set("MoveDown", KeyInput.KEY_S);
        cam.setDirection(player1.getLocalTranslation());
    }
}



Thanks for helping me out :)
jME looks like a awsomely easy 2 use engine, im so glad I found it :D

The first thing I see is that you're not attaching any of your objects to the scene graph, so there's nothing for the renderer to show. You should use rootNode.attachChild(object) to attach it to the scene graph root node.