Skip to content

Conversation

@fernandojsg
Copy link
Member

Description:
When developing the teleport component I noticed that you could set a position value for the camera entity when jumping to another position, but if you set a position for the hand controllers (to follow your head) it won't be taken into consideration when computing the position as right now this position it's just based on the current controller absolute position.

Changes proposed:

  • Compute the delta of absolute movement from the controller (from VRPose) and add it to the position component value for each hand.
var controllerEuler = new THREE.Euler();
var controllerPosition = new THREE.Vector3();
var controllerQuaternion = new THREE.Quaternion();
var deltaControllerPosition = new THREE.Vector3();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been always kind of crappy. Can we create a closure and initialize and reuse these variables instead instancing once per frame? Like this:

https://github.com/aframevr/aframe/blob/master/src/components/raycaster.js#L142

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're already in a closure

},

init: function () {
this.previousControllerPosition = new THREE.Vector3();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this variable to a closure as I indicated below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@dmarcos dmarcos merged commit f01eedf into aframevr:master Oct 24, 2016
z: THREE.Math.radToDeg(controllerEuler.z)
});

deltaControllerPosition.copy(controllerPosition).sub(previousControllerPosition);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a good ol' unit test

@fernandojsg fernandojsg deleted the controllerOffset branch March 14, 2017 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants