The universal lock has been puzzling me for a long time .... The reason here, I thought Euler angular rotation is in the model coordinates (homogeneous coordinate system) for the axis of rotation. The problem is, regardless of the rotation of the axis, the other two axes will change correspondingly, the following look at the picture:
According to the above instructions, the two rotating faces (circles) how can be coplanar, let me confused. Assuming coplanar, the normal of the two rotating surfaces should be the rotation axis, if you want two faces coplanar, that axis of rotation must be parallel. But the problem is that with the model coordinates (homogeneous coordinate system) as the axis of rotation, the other two axes change correspondingly, and are perpendicular to each other, regardless of the axis of rotation. Will not occur coplanar, will not appear Vientiane lock???
On the net, the Euler angle axis rotation is rotated sequentially, that is, the parent-child relationship, such as
Still do not understand the rotation axis where???!
Now I'm using unity to demonstrate
From above, the axes of rotation are perpendicular, regardless of rotation. Assuming that the rotation around the x-axis, the y-axis and the z-axis are established by the rotation of this transformation surface. The problem is, since the rotation of the axis is vertical, as you rotate it, the rotating surface that is established by the other axes rotates, maintaining a vertical relationship. How can there be two rotating surface coplanar??
The following begins the description of the Vientiane lock (in Unity 3D)
First, the rotation order (parent-child relationship) of the unity 3D Euler angle is y-x-z. That is, the rotation of the y-axis x and z axes are changed, the rotation x-axis only changes the z axis, the other axes of the rotation Z axis are unchanged.
Before explaining the explanation, let's explain some left-hand concepts.
The left side of the model---and the coordinate system at which the model was imported, recording the position of the model vertices, etc. through this coordinate system.
The main function---the world coordinate system is to represent the relative position between the model and the model.
The inertial coordinate system---is the same as the model coordinate system origin, but the axis is the same as the world coordinate system, and the function should be the bridge of the model to the world transformation.
For details, please refer to the book "3D Mathematical Fundamentals: Graphics and Game development"
Inertial coordinates are introduced for illustrative purposes (in fact the rotation is carried out in a coordinate system) (which is explained in summary)
View method between unity model coordinate system and inertial coordinate system
Local is the model coordinate system
Global is the inertial coordinate system
If you do not rotate the model, the inertial coordinate system and the model coordinate system coincide, you can click on the button to switch to see.
OK, for the convenience of illustration, we use the auxiliary line to draw the inertial coordinate system to the model, the axis color and the model axis correspond
The code is as follows:
First create a script with the name Tuxingfuzhu.cs script,
Code:
Using Unityengine;
Using System.Collections;
Using Unityeditor;
public class Tuxingfuzhu:monobehaviour {
public mesh mesh;
Use this for initialization
void Start () {
}
<summary>
If you want to draw a gizmos that can be selected, execute this function.
</summary>
void Ondrawgizmos ()
{
Gizmos.color = color.red;
Vector3 direction = vector3.right* 2; Axis X of the World coordinate system
Gizmos.drawray (transform.position, direction);
Gizmos.color = Color.green;
Direction = vector3.up* 2; Axis y of the World coordinate system
Gizmos.drawray (transform.position, direction);
Gizmos.color = Color.Blue;
Direction = vector3.forward* 2; Axis Z of the World coordinate system
Gizmos.drawray (transform.position, direction);
}
<summary>
If you want to draw gizmos when the object is selected, execute this function
</summary>
void ondrawgizmosselected ()
{
Gizmos.color = Color.White;
Gizmos.drawsphere (transform.position, 1);
}
Update is called once per frame
void Update () {
}
}
Code description
Gizmos.drawray//Draw auxiliary rays, refer to the gizmos class on the Unity website for accessibility tools.
The script is then attached to the object to be tested, and here I hang on to the cube object with the following effect:
We see that the model has more than three long lines (inertial coordinates).
OK, now rotate the instructions.
The coordinates are first switched to the model coordinates,
The following rotates the Model X and Z axes 45 degrees respectively.
Click on your test model to see if the effect
OK, now the model coordinates are separated from the inertial coordinates.
OK, now we start rotating the top-most y-axis.
Effects such as:
What have you found???
You will find that the rotation y-axis is rotated around the y-axis of the left side of inertia, not the coordinates of the model.
OK, now set the z axis to 0, then rotate the x axis, the y axis can have a certain degree, in order to make a comparison.
Effects such as:
At this point you will see that the X-axis transformations are transformed around the x-axis of the model coordinates.
OK, then the z-axis transformation, such as:
You will find that the z-axis transformation is also a z-axis transformation around the model.
The problem is almost there. Why Coplanar, because the y-axis transformation will affect the X and z axes, because there are axes at the top of the Transformation (Y-X-Z), the most important is that the y-axis transformation is the model in the inertial coordinate transformation, while the other axes of the transformation is in the model axis transformation. So the situation of the Coplanar (Universal Lock) of the rotating surface will be
The situation of the universal lock is described below.
Rotate the Model X axis 90 degrees (or-90 degrees) (simplest universal Lock)
Rotate the y-axis or z-axis immediately, with the following effect:
This is the universal lock.
You will find that the z-axis rotation and the axis rotation effect are the same, and you will find that the z-axis (model coordinates) and y-axis coordinates (inertial coordinates) are parallel.
The rotational surface of the y-axis (inertia coordinate) and the z-axis (model coordinates) are coplanar as
It is easy to see that the rotation y-axis (inertial coordinates) and the rotation z-axis (model coordinates) are the same effect, except in the opposite direction or the same.
The problem that puzzled me solved.
Summarize:
When a universal lock is produced, two axes of rotation are parallel (the rotational surface coplanar) is the rotation of the model lost in one direction.
The main thing is to figure out what kind of coordinates the rotation revolves around.
The above explanation simply explains the universal lock on the surface.
In fact, the rotation of the model is rotated in a coordinate system. But the above explanation is equivalent. Explain below.
The rotational process of the computer model is not the continuous rotation we want. What do you mean?
Suppose u3d rotates 5 degrees per frame around Y, his rotation is: the first rotation from (0,0,0) around the Y axis 5 degrees (0,5,0), until now there is no problem, the second rotation will be what the situation.
It is said that simple, and then from now on the transformation of the model rotation (0,5,0) around the y-axis rotation 5 degrees----> (0,10,0) not on the line. But the computer does not do this. It is the change in the original model coordinates (0,0,0) that starts again,
i.e. (0,0,0)------> (0,10,0).
That is, the transformation of the model is (0,0,0) begin to transform, the idea, know this is the most important.
When the model rotates around y-x-z order, when the model rotates:
1. The order of each transformation is (0,0,0)--------------> (x, Y, z), that is, start with (0,0,0), first transform the y-axis, on the transformation of the Xray, and then on the transformation axis.
Every time you have a change, repeat the 1 process.
Each rotation rotates first around the y-axis, so the y-axis direction of each rotation transformation is constant, coincident with the inertial coordinates. So my rotation above is explained by the inertial coordinates. In fact, this confusion is in the chronological order of production, accurate
Said to be a common axis or coplanar in time.
Below I demonstrate the transformation process such as:
Three graphics Transformations (0,0,0)-----> (58,67,40) are shown above. (0,0,0)--------> (45,87,60); (0,0,0)--------> (45,67,67)
At the time of the transformation, the internal program starts (0,0,0) the Transformation (algorithm). Even if you u3d the parameter setting again, you can transform it in the existing transform, but the inside of the program starts from (0,0,0).
From the above three (or more) transformations, you will find that the axis of the first y-axis transformation of the three transformations is the same. The green circle is the revolving face.
Next is the x-axis rotation and the z-axis rotation. Even if the y-axis is transformed, the y-axis is constant for the first time around the y-axis transformation of the three changes. So the y-axis and z-axis are collinear, or the rotation axis of the y-axis and the z-axis are coplanar only
Is the coplanar side of the time transformation. (Creation of Universal Lock)
In U3d, the rotation order is y-x-z (model coordinates---inertial coordinate system rotation), the official website is z-x-y (inertial coordinate system----model coordinates).
The y-axis is the y-axis of the inertial coordinate system, and the other axes are the axes of the model. This is because the axes of different coordinate systems can produce coplanar
If you do not understand the coordinate system, please refer to the "3D Mathematical Fundamentals: Graphics and Game development" book.
Let's make an ad. Recommend it, very basic, very easy-to-understand graphic learning books.
Vientiane Lock related Videos
Http://v.youku.com/v_show/id_XNzkyOTIyMTI=.html
Unity--------------------Concept of universal lock