-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Add 'position' support for Trackedcontrols #2002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| var controllerEuler = new THREE.Euler(); | ||
| var controllerPosition = new THREE.Vector3(); | ||
| var controllerQuaternion = new THREE.Quaternion(); | ||
| var deltaControllerPosition = new THREE.Vector3(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/components/tracked-controls.js
Outdated
| }, | ||
|
|
||
| init: function () { | ||
| this.previousControllerPosition = new THREE.Vector3(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
fd31500 to
c76944a
Compare
| z: THREE.Math.radToDeg(controllerEuler.z) | ||
| }); | ||
|
|
||
| deltaControllerPosition.copy(controllerPosition).sub(previousControllerPosition); |
There was a problem hiding this comment.
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
Description:
When developing the teleport component I noticed that you could set a
positionvalue for the camera entity when jumping to another position, but if you set apositionfor 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:
positioncomponent value for each hand.