Closed xyzdcgan closed 5 years ago
The gizmo is applying the edit matrix at the end of the transformation operation : https://github.com/stephomi/sculptgl/blob/d543420e01e56c5e82087514fad8832c12ddffe3/src/editing/tools/Transform.js#L71
So the absolute rotation value from the initial position is lost.
You can avoid this behavior with :
applyEditMatrix(iVerts) {
var mesh = this.getMesh();
var em = mesh.getEditMatrix();
mat4.mul(mesh.getMatrix(),mesh.getMatrix(),mesh.getEditMatrix())
mat4.identity(em);
}
// correct undo-redo
pushState() {
var mesh = this.getMesh();
var tmpMat = mat4.clone(mesh.getMatrix());
var undocb = function () {
mat4.copy(mesh.getMatrix(), tmpMat);
};
this._main.getStateManager().pushStateCustom(undocb, undocb);
}
// also comment this._main.getStateManager().pushVertices(iVerts); above
It will impact how the symmetry is handled though (and probably other things I forgot)
I think there is a mistake @stephomi , For eg here is an object where assume x,y,z are 0,0,0
After changing that using gizmo, it look like
How can i get x,y,z of this current 3d object, that at what angle is it placed.
For finding that i used _updateRotateEdit() method in Gizmo.js. I am getting angles from that, but is there any other thing through which i can get x,y,z
Thanks @stephomi
You can get if from the mesh matrix (if you use my code above)
Yes, i added that code and got the rotation values thanks for that @stephomi , also can you tell if can get what is angle between the plane and 3d object, means the grid/surface and 3d object which is loaded. @stephomi Thank You.
Hello, @stephomi ,
I have checked the code for getting the current angle of 3d object, and I am able to find the last value of x,y,z from _updateRotateEdit() method in Gizmo.js.
Where when i change any axis-green-blue-red i get the last value of that, but is there any other thing in code which can give us the current angle of 3d object exact x,y,z value.
Thanks @stephomi