-
-
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
Math: Added Vector3.setFromEuler(); removed Euler.toVector3() #23494
Conversation
link.rotation | ||
.toVector3( _vector ) | ||
.max( rotationMin ) ); | ||
link.rotation.setFromVector3( _vector.setFromEuler( link.rotation ).max( rotationMin ) ); |
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.
/ping @takahirox
-
There does not appear to be a test case for use of
rotationMin/Max
. Personally, I do not think it makes sense to clamp Euler angles anyway -- except in very special cases. -
Also unrelated to this PR, I am not sure you want to call
updateMatrixWorld()
a few lines later. Maybe useupdateWorldMatrix()
, where you can control recursion?
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.
Thanks for pointing out. Let me take a look closer later...
6030c77
to
6ce3832
Compare
@@ -403,7 +403,7 @@ function SidebarObject( editor ) { | |||
} | |||
|
|||
const newRotation = new THREE.Euler( objectRotationX.getValue() * THREE.MathUtils.DEG2RAD, objectRotationY.getValue() * THREE.MathUtils.DEG2RAD, objectRotationZ.getValue() * THREE.MathUtils.DEG2RAD ); | |||
if ( object.rotation.toVector3().distanceTo( newRotation.toVector3() ) >= 0.01 ) { | |||
if ( new THREE.Vector3().setFromEuler( object.rotation ).distanceTo( new THREE.Vector3().setFromEuler( newRotation ) ) >= 0.01 ) { |
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.
Unrelated to this PR, this code block instantiates new object frequently. At least it is now more honest about it, and is no worse than before.
Thanks! |
## Description Remove the description of toVector3 from Euler's Chinese document. ## Reason Euler's toVector3 method has been removed (#23494), but the Chinese document still retains the description of the API.
This new method parallels the existing
Vector3.setFrom*()
methods.Similarly,
Euler.setFromVector3()
.We also avoid "optional targets" in core. This should have been fixed previously; it was just missed.