@@ -43,8 +43,10 @@ module.exports.Component = registerComponent('tracked-controls', {
4343 var controllerEuler = new THREE . Euler ( ) ;
4444 var controllerPosition = new THREE . Vector3 ( ) ;
4545 var controllerQuaternion = new THREE . Quaternion ( ) ;
46+ var deltaControllerPosition = new THREE . Vector3 ( ) ;
4647 var dolly = new THREE . Object3D ( ) ;
4748 var standingMatrix = new THREE . Matrix4 ( ) ;
49+ var previousControllerPosition = new THREE . Vector3 ( ) ;
4850 controllerEuler . order = 'YXZ' ;
4951 return function ( ) {
5052 var controller ;
@@ -74,10 +76,15 @@ module.exports.Component = registerComponent('tracked-controls', {
7476 y : THREE . Math . radToDeg ( controllerEuler . y ) ,
7577 z : THREE . Math . radToDeg ( controllerEuler . z )
7678 } ) ;
79+
80+ deltaControllerPosition . copy ( controllerPosition ) . sub ( previousControllerPosition ) ;
81+ previousControllerPosition . copy ( controllerPosition ) ;
82+ var currentPosition = el . getAttribute ( 'position' ) ;
83+
7784 el . setAttribute ( 'position' , {
78- x : controllerPosition . x ,
79- y : controllerPosition . y ,
80- z : controllerPosition . z
85+ x : currentPosition . x + deltaControllerPosition . x ,
86+ y : currentPosition . x + deltaControllerPosition . y ,
87+ z : currentPosition . x + deltaControllerPosition . z
8188 } ) ;
8289 } ;
8390 } ) ( ) ,
0 commit comments