Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(int worldX = 0; worldX<screenWidth/scale; worldX+=1) {
- for(int worldY = 0; worldY<screenHeight/scale; worldY+=1) {
- xS = Math.sin((((float) (worldX-screenWidth/scale/2)/(screenWidth/scale))*75+xRot)/180*Math.PI)*3 * Math.cos((((float) (worldY-screenHeight/scale/2)/(screenHeight/scale))*45+yRot)/180*Math.PI)*3;
- yS = Math.sin((((float) (worldY-screenHeight/scale/2)/(screenHeight/scale))*45+yRot)/180*Math.PI)*3 * Math.cos((((float) (worldX-screenWidth/scale/2)/(screenWidth/scale))*75+xRot)/180*Math.PI)*3;
- zS = Math.cos((((float) (worldX-screenWidth/scale/2)/(screenWidth/scale))*75+xRot)/180*Math.PI)*3;
- for(float ray=0; ray<=renderDistance; ray+=depthPercision+ray/100) {
- x = (Math.abs((camX+xS*ray)) % worldWidth);
- y = camY+yS*ray;
- z = (Math.abs((camZ+zS*ray)) % worldLength);
- if(world[(int) x][(int) y][(int) z] != null) {
- //I just hit a block...
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment