So I have different objects . All are similar in shape but their rotations are different .
For eg : Each Object has a circular shape , But each has variable rotations.
I want to align them so that all have the same alignment .
Is there any function available in three.js to make them aligned properly .
I had provided a basic example image below :
Can anyone help me how can I achieve this .
Any small help would be much appreciated.
Define “properly” ?
Which rotation would be proper for a cat-dog model (let alone for an egg-shaped model that probably has more degrees of freedom) ? As mentioned in your previous thread, computers can’t read visual contexts (without NN at least), only numbers.
Sorry If my explanation was bad . Properly insense to a certain defined rotation .
I had attached another image below hope that would explain better.
For this context lets say I have different cat 3d models . But they were not set to correct rotation . The left Obj 1 and Obj 2 in the image represent the source objects and I have a correctly rotated 3d model which is similar in shape and size to others. This is the target source object.
I want Obj1 and Obj2 to match against Target model and align themselves to get the same position as the Target model .
I don’t know if this is a simple task .
Is this possible to do as I cannot predict the source objects rotation before hand I can’t set rotation values .
Nope, unless the model tells you which part of it is the “front” - it’s (afaik) not possible to calculate the rotation based just on an arbitrary model and another reference (the only information you get from a simple 3D model, that may be useful, is scale / width / depth - but calculating a rotation based on these would be so incredibly error-prone it’s not worth investing much time in.)
If model tells you which part is the original front, you can calculate the difference between the world front vector (ie.
Vector3(0.0, 0.0, ±1.0)) and the model front vector (converted to world-space), then rotate the model in the opposite direction.
Note: some Blender models exported as scenes can have their local transformations saved in the file. If that’s the case, unsetting these transformations should be enough to reset the model to an original state.
Thanks for the quick response . I would also like to know , if I wanted to rotate only on one axis lets say only along Z axis while the X and Y will stay still , Can it be done by comparing with Target model ?
I am directly creating models in the scene and trying to view them . So I guess Blender couldn’t be used .
I don’t think so - I can imagine how that could be done, but in weird and messy ways, so I’ll leave this, maybe someone else will know.
That’s alright , Thanks for your time , Much appreciated