# Align / Rotate all objects to make all same

Hey ,

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.

Thanks

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.

1 Like

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.

1 Like

Thatâ€™s alright , Thanks for your time , Much appreciated