Skybox issues

Given the API for the SkyFactory() what am i doing wrong or missing?



[java]private void initSky()

{

SkyFactory skyBox = new SkyFactory();



Material skyWest = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

skyWest.setTexture("Skybox", assetManager.loadTexture("Textures/Sky/SimpleSky/left.png"));



Material skyEast = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

skyWest.setTexture("Skybox", assetManager.loadTexture("Textures/Sky/SimpleSky/right.png"));



Material skyNorth = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

skyWest.setTexture("Skybox", assetManager.loadTexture("Textures/Sky/SimpleSky/front.png"));



Material skySouth = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

skyWest.setTexture("Skybox", assetManager.loadTexture("Textures/Sky/SimpleSky/back.png"));



Material skyUp = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

skyWest.setTexture("Skybox", assetManager.loadTexture("Textures/Sky/SimpleSky/up.png"));



Material skyDown = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

skyWest.setTexture("Skybox", assetManager.loadTexture("Textures/Sky/SimpleSky/down.png"));



skyBox.createSky(assetManager, skyWest, skyEast, skyNorth, skySouth, skyUp, skyDown, Vector3f.UNIT_XYZ);

//rootNode.attachChild(skyBox);

}[/java]



Am i even instantiating this properly? It doesnt seem so…

1 Like

if you have 6 faces (must all be same size) you can do something like this:



[java]Texture west = assetManager.loadTexture("Textures/west.jpg");

Texture east = assetManager.loadTexture("Textures/east.jpg");

Texture north = assetManager.loadTexture("Textures/north.jpg");

Texture south = assetManager.loadTexture("Textures/south.jpg");

Texture up = assetManager.loadTexture("Textures/up.jpg");

Texture down = assetManager.loadTexture("Textures/down.jpg");



Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);

rootNode.attachChild(sky);[/java]

1 Like

I modified my code to match what you have (with my own extensions and such) and im getting an “illegal start of expression”



[java]private void initSky()

{

Texture skyWest = assetManager.loadTexture(“Textures/Sky/SimpleSky/left.png”);

Texture skyEast = assetManager.loadTexture(“Textures/Sky/SimpleSky/right.png”);

Texture skyNorth = assetManager.loadTexture(“Textures/Sky/SimpleSky/front.png”);

Texture skySouth = assetManager.loadTexture(“Textures/Sky/SimpleSky/back.png”);

Texture skyUp = assetManager.loadTexture(“Textures/Sky/SimpleSky/up.png”);

Texture skyDown = assetManager.loadTexture(“Textures/Sky/SimpleSky/down.png”);



Spatial sky = SkyFactory.createSky(assetManager, skyWest, skyEast, skyNorth, skySouth, skyUp, skyDown,);

rootNode.attachChild(sky);

}[/java]



On the Spatial sky = etc etc line.

get rid of the last comma

1 Like

Thanks. I have my jmonkey window paneled in Windows 7, so the ends of lines are cut off.



Also little tiny typos throwing everything off never gets old.

1 Like
@disrupter52 said:
Also little tiny typos throwing everything off never gets old.


Typos in programming are called Syntax Errors. Compilers cant assume anything. If you put a comma, you are saying there is another parameter so the compiler looks for a type, then a variable name that the parameter will be referenced by within that method scope. You didn't provide a type or a name, so it fails to compile.

If you have netbeans configured properly, it should detect these syntax errors and flag them.
1 Like

Good answer, why the necro though?