I am always studying. I don't know what to do with Unity (rather than dealing with 3D space in general)
Since there was a point, let me ask a question.
There are different local coordinate systems A and B, and objects P and Q with the same global coordinates are children of A and B, respectively.
I want to move Q by applying rotation Y in the local coordinate system of B to the place where I moved by applying rotation X in the local coordinate system of A
thinking about. I would like to obtain a result where P and Q are in the same place in the global coordinate system.
Please tell me how to find the rotation Y.
Specific examples・ New scene
Create EmptyObject A in the global coordinate system. Globalrotation (also local) is (12,34,56)
Create EmptyObject B in the global coordinate system (globalrotation (local is also) is (78,90,12)
・ EmptyObject P and Q are created in the global coordinate system globalposition (also local) is (3.4, 5.6, 7.8)
Move P to A child and Q to B child on Hierarchy
* Each coordinate is appropriate.
Applicable source codeIn the situation above,
Transform P = GameOjbect.Find ("P"). GetComponent<Transform>();
Transform Q = GameOjbect.Find ("Q"). GetComponent<Transform>();
P.localPosition = Quaternion.Euler (12,34,56) * P.localPosition;
Q.localPosition = ?????????????????????????? * Q.localPosition;
#as a result
P.Position == I want to match the global coordinate value with Q.Position
In this case, how can I find the above ?????????????
Tried
I tried various things using Quaternion.Inverse etc., but because I have little mathematical knowledge and no experience value
I didn't get the answer I wanted.
・ Points to consider when solving these problems
・ Points to be careful
etc., I would appreciate it if you could teach me.
Supplemental information (FW/tool version etc.)Unity2018.2
C #

Answer # 1
Related articles
 c #  about unity ads test ad display
 c #  rotation control of 3d game objects in unity
 c #  about player prefs for unity
 about programming basics unity c #
 c #  about the solution and cause of the "parameter count mismatch" bug
 java  about conversion of date type format
 about cut editing of unity legacy animation
 java  about string conversion using the methods of the string class
 about debugging online games with unity
 about wss communication using websocketsharp in unity
 about code errors in unity
 about php character conversion
 c#  about random generation of unity objects and setting of initial position
 about tilemapgettile specifications of unity
 unity  conversion and compatibility of mesh (collider) and polygon (collider)
 unity  about key input information acquisition in executeineditmode
 i'm not sure about an error when running unity build
 html  about conversion to haml
 about unity errors
 unity: transform rotation doesn't follow animation
 c #  i want to rotate the gyro sensor of the smartphone and the object of the smartphone on the scene in sync with unity
 c #  unity about camera control i want to zoom with mouse scroll
 c #  how to render with different shaders by camera in unity urp
 c #  unity) video thumbnails
 c #  scene cannot be moved using scritable object
 c #  point the camera with the plane rotated 90 degrees in unity
 c #  i want to be able to visually understand the time it takes to hold an item for each item
 c #  [unity ray cast] execute the function of the object that received the ray
 c #  i want to create an npc that tracks multiple players by switching targets
 c #  unity) i want to get the image size in prefab
How about this?
Are you doing well? Although there are some errors, I think they will generally agree. It looks like a math problem and is interesting.
Note that the order of multiplication of quaterniontype factors is noncommutative, so when transforming the equation, when multiplying both sides with quaternions, if the left side is from the right, the right side is also from the right, left Will it be from the left ... from the left?