1
Support / Paradroidz question...
« on: August 31, 2006, 06:33:45 am »
How did you achieve such perfect lighting in Paradroidz? I looked through your level code, and your placing walls by referancing a text file and placing them accordingly - so your levels are not in one 3DS object file. Okay anyway, so I tried loading my walls and floors the same way, individually placing them (I already wanted to do it this way before I even found the Paradroidz source) accordingly. But my lighting is all messy. Take a look: http://www.jamisongames.info/Screenshot.jpg
Here's some of my code:
The "....." represents code that's not necessary to be shown.
Here's some of my code:
Code: [Select]
String map[] = {
" ********",
" *......*",
" ***......*",
" *........***",
"********.....*",
"*......*.....******",
"*......D..........*",
"*......*..........*",
"********..........*",
" *..............*",
" ****************"
};
.....
public void Init() {
ObjectHolder.init();
world.setAmbientLight(200, 200, 200);
camera.rotateCameraX((float)Math.toRadians(32));
camera.setPosition(new SimpleVector(10, -10, -5));
world.addLight(new SimpleVector(10, -0.5, 10), 255, 0, 0);
world.setLightDiscardDistance(0, 5);
BuildLevel();
}
public void BuildLevel() {
int mapH = map.length;
for (int i=0; i<mapH; i++) {
int mapW = map[i].length();
for (int j=0; j<mapW; j++) {
char c = map[i].charAt(j);
if (c == '*') {
Object3D wall = new Object3D(ObjectHolder.getObject(0));
float bBox[] = wall.getMesh().getBoundingBox();
wall.translate(bBox[1]*j, 0, bBox[5]*i);
world.addObject(wall);
}
if (c == '.') {
Object3D floor = new Object3D(ObjectHolder.getObject(1));
float bBox[] = floor.getMesh().getBoundingBox();
floor.translate(bBox[1]*j, 0, bBox[5]*i);
world.addObject(floor);
}
}
}
world.buildAllObjects();
}
.....
The "....." represents code that's not necessary to be shown.