Open superajia opened 3 years ago
It seems your change is not correct. Even when applying it, you don't get the expected result if you rotate the scene in misc_controls_transform
. TransformControls
possibly does not fully support transformed ancestors.
/ping @arodic
Even when applying it, you don't get the expected result if you rotate the scene in
misc_controls_transform
Thank you for your reply. I don't know what this sentence means "Even when applying it, you don't get the expected result if you rotate the scene in misc_controls_transform" I use the OrbitControl.js to rotate the scene and get the expected result in my way. Look forward to your reply.
I use the OrbitControl.js to rotate the scene and get the expected result in my way.
You are probably transforming the camera. Try adding scene.rotation.x = Math.PI * 0.5;
in misc_controls_transform
.
According to your suggestion,I tried adding scene.rotation.y = Math.PI * 0.5. However, this lead to more problems. The purpose of using Transform.js is to move objects in the scene, not scene. If you don't transform the scene,my modify will work. Look forward to your reply.
This also does not work in the r137. This is what I have ended up with, the problem seams to be a parent transform. ` if ( space === 'world' ) {
if ( object.parent ) {
object.getWorldPosition(_tempVector);
if ( axis.search( 'X' ) !== - 1 ) {
_tempVector.x = Math.round( _tempVector.x / this.translationSnap ) * this.translationSnap;
}
if ( axis.search( 'Y' ) !== - 1 ) {
_tempVector.y = Math.round( _tempVector.y / this.translationSnap ) * this.translationSnap;
}
if ( axis.search( 'Z' ) !== - 1 ) {
_tempVector.z = Math.round( _tempVector.z / this.translationSnap ) * this.translationSnap;
}
object.position.copy(object.parent.worldToLocal(_tempVector));
}
else {
if ( axis.search( 'X' ) !== - 1 ) {
object.position.x = Math.round( object.position.x / this.translationSnap ) * this.translationSnap;
}
if ( axis.search( 'Y' ) !== - 1 ) {
object.position.y = Math.round( object.position.y / this.translationSnap ) * this.translationSnap;
}
if ( axis.search( 'Z' ) !== - 1 ) {
object.position.z = Math.round( object.position.z / this.translationSnap ) * this.translationSnap;
}
}
}`
Describe the bug
Using TransformControls to move an object along the axis, the path is not correct
To Reproduce
Use TransformControls to move the object along the axis. When the following three conditions are met, the path is not correct
This object has a parent object that has been rotated
The coordinate space is 'world'
The translationSnap is a a numeric value
Code TransformControls.js line 421
Live example
Expected behavior
Using TransformControls to move an object along the axis, the path is correct.
Screenshots
Platform: