@@ -51,6 +51,7 @@ class Game {
5151 } ) ;
5252 this . renderer . sortObjects = true ;
5353 this . scene = new THREE . Scene ( ) ;
54+ this . playerPos = [ 0 , 0 , 0 ] ;
5455 this . dimBg = {
5556 "minecraft:overworld" : [ 165 / 255 , 192 / 255 , 254 / 255 ] ,
5657 "minecraft:the_end" : [ 1 / 255 , 20 / 255 , 51 / 255 ] ,
@@ -169,6 +170,7 @@ class Game {
169170 _this . inv_bar . setXp ( xp . level , xp . progress ) ;
170171 } ) ;
171172 this . socket . on ( "move" , function ( pos ) {
173+ _this . playerPos = [ pos . x - 0.5 , pos . y , pos . z - 0.5 ] ;
172174 var to = {
173175 x : pos . x - 0.5 ,
174176 y : pos . y + _this . headHeight ,
@@ -179,6 +181,17 @@ class Game {
179181 . easing ( TWEEN . Easing . Quadratic . Out )
180182 . start ( ) ;
181183 } ) ;
184+ this . impulse = function ( ) {
185+ var to = {
186+ x : _this . playerPos [ 0 ] ,
187+ y : _this . playerPos [ 1 ] + _this . headHeight ,
188+ z : _this . playerPos [ 2 ] ,
189+ } ;
190+ new TWEEN . Tween ( _this . camera . position )
191+ . to ( to , 100 )
192+ . easing ( TWEEN . Easing . Quadratic . Out )
193+ . start ( ) ;
194+ } ;
182195 this . socket . on ( "entities" , function ( entities ) {
183196 _this . ent . update ( entities ) ;
184197 } ) ;
0 commit comments