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
How to use matrix for transformation #1593
Comments
The simpliest way to do that is to "center" the pivot of your geometry so that every transformation you'll do to this object will be relative to its center. Right after loading your geometry center it before creating your |
Or... mesh.geometry.applyMatrix( new THREE.Matrix4().setTranslation( -10,-22,-30 ) ); |
Thanks kovleouf, it's a good idea to do THREE.GeometryUtils.center( geometry ), I tried and objects are at the center of the frame at the obsolute position (0,0,0). But I have an other constraint :/ Thanks mrdoob mesh.geometry.applyMatrix( new THREE.Matrix4().setTranslation( -10,-22,-30 ) ) was useful to apply transformation on my objet. :) But I have a particular case, indeed my objects have specifics positions compared to others. I have a bone with anatomical points, when I load bones and anatomical points, they are automatically position on the bone at strategic position for future calculations. If I move everything with THREE.GeometryUtils.center( geometry ) I loose the position of anatomicals points. I hope that my explications are clear ^^ |
Then use a dummy object. var dummy = new THREE.Object3D();
dummy.position.set( -10,-22,-30 );
scene.add( dummy );
dummy.add( mesh ); Now you can rotate |
Interesting, Thanks I will try it :) |
Actually, that's wrong. It should be like this: var dummy = new THREE.Object3D();
scene.add( dummy );
mesh.position.set( -10,-22,-30 );
dummy.add( mesh ); Now you can rotate |
Hello everybody,
I want display an object in my navigator which come from a stl file. I load it and i display it. It is far away on the display, it is not at the center of the frame. When I open my stl file with "blender", I remark that my object is not localised at the center of the frame. Indeed, he is at (10,22,30) for example. So, the object in my navigator is at the same position that in "blender". So, I translate it with some calculation at the center of the landmark. BUT ^^, I remark that the attribute "position" of the object had values (0,0,0) at the initial position (before I translate it at the center of the frame, so (0,0,0) = (10,22,30) in obsolute frame), consequently after the translation, the object has position (-10,-22,-30). When I try to use setRotation(a), to rotate my object, it rotates around HIS origin that is to say (10,22,30) !!! How can I rotate my object on itself ? I would like that the center of the rotation be the center of the frame. I would like a function where I can specify the center of rotation.
David
The text was updated successfully, but these errors were encountered: