Search Unity

Rotate an object from an axis to another axis

Discussion in 'Scripting' started by KevinLegendre, Mar 30, 2015.

  1. KevinLegendre

    KevinLegendre

    Joined:
    Mar 16, 2015
    Posts:
    8
    Hello, I have two objects A and B with two differents coordinates sytems (Object A the Y axis is up and for object B the z axis is Up).

    I would like to rotate the object B to have its x axis align with the x axis of the object A.

    I tried with quaternion but all the object B is rotating to match with the A. I would like the object B rotates around its Z axis until the two x axis are align.

    Thank you in advance.
     
    Last edited: Mar 30, 2015
  2. KevinLegendre

    KevinLegendre

    Joined:
    Mar 16, 2015
    Posts:
    8
    For more explanations :
    I have :

    I have.jpg

    I want :

    I want.png

    The only way I found is to make
    objectB.rotation = ObjectA.rotation
    and add the right Euler Angle to rotate the trasform of the B Object.
    But if there are a solution to directly align the axis it will be better
     
    Last edited: Mar 30, 2015