@@ -459,7 +459,7 @@ class Terrain {
459459 } )
460460 }
461461 updateCellMesh ( cellX , cellY , cellZ ) {
462- console . log ( `updating cell: ${ cellX } :${ cellY } :${ cellZ } `)
462+ console . warn ( `Updating cell: ${ cellX } :${ cellY } :${ cellZ } `)
463463 var cellId = this . vec3 ( cellX , cellY , cellZ ) ;
464464 if ( this . cellsData [ cellId ] . needsUpdate ) {
465465 var mesh = this . cells [ cellId ] ;
@@ -908,6 +908,7 @@ function init(){
908908 scene,
909909 camera,
910910 } )
911+
911912
912913
913914 //Load Custom blocks models
@@ -1099,20 +1100,19 @@ function render() {
10991100
11001101 }
11011102 renderer . render ( scene , camera ) ;
1102- terrain . updateCells ( )
11031103
1104-
1105- var rayBlock = terrain . getRayBlock ( ) ;
1106-
1107- if ( rayBlock ) {
1108- var pos = rayBlock . posBreak ;
1109- pos [ 0 ] = Math . floor ( pos [ 0 ] )
1110- pos [ 1 ] = Math . floor ( pos [ 1 ] )
1111- pos [ 2 ] = Math . floor ( pos [ 2 ] )
1112- cursor . position . set ( ...pos )
1113- // console.log(pos)
1114- cursor . visible = true ;
1115- } else {
1116- cursor . visible = false ;
1117- }
1118- }
1104+ terrain . updateCells ( )
1105+ //update cursor
1106+ var rayBlock = terrain . getRayBlock ( ) ;
1107+ if ( rayBlock ) {
1108+ var pos = rayBlock . posBreak ;
1109+ pos [ 0 ] = Math . floor ( pos [ 0 ] )
1110+ pos [ 1 ] = Math . floor ( pos [ 1 ] )
1111+ pos [ 2 ] = Math . floor ( pos [ 2 ] )
1112+ cursor . position . set ( ...pos )
1113+ // console.log(pos)
1114+ cursor . visible = true ;
1115+ } else {
1116+ cursor . visible = false ;
1117+ }
1118+ }
0 commit comments