-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Add unit test for Object3D and Camera #7114
Conversation
…tWorldQuaternion. Also add a unittest for camera lookAt
see #7108 |
|
||
// get a reference object for comparing | ||
var reference = obj.rotateOnAxis(new THREE.Vector3(1, 0, 0), 45).rotation; | ||
obj.rotateX(45); |
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.
rotateX()
calls rotateOnAxis()
. You are not actually testing anything here.
This appears to be an issue throughout this PR.
Also, Euler rotations are not unique. I do not think it is wise to compare them. Perhaps comparing the quaternions is best. But even so, the negation of a unit quaternion represents the same rotation.
@simonThiele Thank you for working on the unit tests. It is important! |
Do you mind going a "Indent spaces to tabs" in these files? We try to use tabs for indenting. |
yep, using tabs now. |
var obj = new THREE.Object3D(); | ||
|
||
obj.lookAt(new THREE.Vector3(0, -1, 1)); | ||
ok( obj.getWorldRotation().x * RadToDeg === 45 , "x is equal" ); |
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.
getWorldRotation()
or getWorldQuaternion()
?
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.
getWorldQuaternion! thx
Add unit test for Object3D and Camera
Sweet! Thanks! |
As discussed last evening here is the PR with some unit tests for Object3D.