-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Sync rotation/position with Object3D #3245
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
846b01b to
5cf51b7
Compare
src/core/a-entity.js
Outdated
| var component = this.components[attr]; | ||
| var component; | ||
| if (attr === 'position') { return this.object3D.position; } | ||
| if (attr === 'rotation') { return this.getRotation(); } |
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.
scale as well
src/core/a-entity.js
Outdated
| this.object3D.el = this; | ||
| this.object3DMap = {}; | ||
| this.parentEl = null; | ||
| this.rotationEuler = new THREE.Euler(); |
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.
used?
src/core/a-entity.js
Outdated
| var radToDeg = THREE.Math.radToDeg; | ||
| var rotation = this.object3D.rotation; | ||
| var rotationObj = this.rotationObj; | ||
| rotationObj.x = radToDeg(rotation.x); |
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.
not too long to have written out, consider:
this.rotationObj.x = THREE.Math.degToRad(this.object3D.rotation.x);
this.rotationObj.y = THREE.Math.degToRad(this.object3D.rotation.y)
this.rotationObj.z = THREE.Math.degToRad(this.object3D.rotation.z)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.
I also think this is better as a private method outside the prototype:
getRotation (rotation, target)
5cf51b7 to
348431c
Compare
One can now edit the position and rotation of the object3D directly and getAttribute and setAttribute will return consistent values.
348431c to
2341040
Compare
|
done! |
No description provided.