Tutorials

Hi.



There is an error in the Scene Graph Basics code.



The block:



protected void initGame() {
    Vector3f[] vertex = new Vector3f[1000];
    ColorRGBA[] color = new ColorRGBA[1000];
    for(int i = 0; i < 1000; i++) {
        vertex[i] = new Vector3f();
        vertex[i].x = (float)Math.random() * 50;
        vertex[i].y = (float)Math.random() * 50;
        vertex[i].z = (float)Math.random() * 50;
        color[i] = new ColorRGBA();
        color[i].r = (float)Math.random();
        color[i].g = (float)Math.random();
        color[i].b = (float)Math.random();
        color[i].a = 1.0f;
        Point p = new Point(vertex,null,color,null);
        p.setLocalTranslation(-200,-25,-25);
        scene = new Node();
        scene.attachChild(p);
    }
}



should probably read:


protected void initGame() {
    Vector3f[] vertex = new Vector3f[1000];
    ColorRGBA[] color = new ColorRGBA[1000];
    for(int i = 0; i < 1000; i++) {
        vertex[i] = new Vector3f();
        vertex[i].x = (float)Math.random() * 50;
        vertex[i].y = (float)Math.random() * 50;
        vertex[i].z = (float)Math.random() * 50;
        color[i] = new ColorRGBA();
        color[i].r = (float)Math.random();
        color[i].g = (float)Math.random();
        color[i].b = (float)Math.random();
        color[i].a = 1.0f;
    }
    Point p = new Point(vertex,null,color,null);
    p.setLocalTranslation(-200,-25,-25);
    scene = new Node();
    scene.attachChild(p);
}



- Shane

Thank you, you are correct. I’ll make the correction. I’m trying to get the tutorials caught up the code now anyways.



Thanks.