我的代码
private Node enemies;
private void initEnemies(){
enemies = new Node();
Box boxMesh = new Box(1f, 1f, 1f);
Geometry boxGeo = new Geometry("Colored Box", boxMesh);
Material boxMat = new Material(getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
boxMat.setBoolean("UseMaterialColors", true);
boxMat.setColor("Ambient", ColorRGBA.Blue);
boxMat.setColor("Diffuse", ColorRGBA.Blue);
boxGeo.setMaterial(boxMat);
boxGeo.setLocalTranslation(playerNode.getLocalTranslation());
boxGeo.setUserData("Health", 100);
enemies.attachChild(boxGeo);
rootNode.attachChild(enemies);
}
@Override
public void simpleInitApp() {
initAsset();
initState();
initThis();
flyCam.setEnabled(false);
stateManager.detach(stateManager.getState(FlyCamAppState.class));
MyCamera myCam = new MyCamera(cam);
myCam.registerWithInput(inputManager);
stateManager.attach(new GunState());
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
initTerrain();
initLight();
initHUD();
initPlayer();
initEnemies();
}没有显示:(没有错误,没有主机崩溃,没有退出游戏,有人知道如何修复它吗?都在工作,但这不是敌人:(
我需要在我的3d游戏中使用jmonkeyengine 3
Thx寻求任何帮助
发布于 2014-11-12 16:14:50
您可能需要添加一个灯光来查看您的长方体,并将其附加到长方体。
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(1f, 1f, 1f)).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.attachChild(Box);
rootNode.addLight(sun);发布于 2015-01-05 02:08:40
另一种解决方案是将Common/MatDefs/Light/Lighting.j3md更改为Common/MatDefs/Misc/Unshaded.j3md,并删除漫反射和环境色定义,而不是使用颜色颜色定义。正如Jman2所说,它的发生是因为闪电材质需要场景中的光。未着色材质不需要灯光。试一试--应该会有帮助。
https://stackoverflow.com/questions/26841869
复制相似问题