![]() Now consider that X axis is represented by a unit length vector (1.0, 0, 0), what GetUnitAxis(EAxis::X) do is basically applying the rotation transformation into that unit length Vector pointing to the X axis, which produces where the vector pointing to after it gets rotated (which is why you get FVector).Developers have access to an array of video game engines that help power their projects. It then calculates the combined transformation matrix.ĬombinedMat = yMat pMatrMat (basically it does the transformations in order) The FRotationMatrix consist of three component, the yaw transformation matrix (yMat), the pitch transformation matrix (pMat), and of course roll transformation matrix (rMat). I meant, it is basically a transformation matrix, what does GetUnitAxis has to do with it? Because transformation matrix, in its plain form, has nothing to do with axis! What I am expecting is to multiply this Matrix with a point or another vector, but what I get is this weird GetUnitAxis function call!Īfter diving in into the engine code, I think I finally get it. If you come from mathematical background just like me, the interface of FRotationMatrix feels rather off. I know it is a very late reply, but I think I kind of get what the OP is asking. So, this code ties the forward movement speed of the character to its orientation. Then, if you rotate 90 degrees, you should not be able to move at all, because you are pointing perpendicular to the X direction.How much of that is in the X-direction? (Dot Product). Take the unit vector of where I am pointing at. You are saying something like: "I am looking to the left. Remember how discussion about how airplane looks at the picture? This is a bit similar. This code gets the rotation, Yaw (around Z axis, or around the Character Body, basically if you are standingf acing the TV, and you rotate left or right of the TV).It seems to me that based on your rotation with respect to z axis, you are adjusting the speed of your movement. So, this code below gets the rotation of Controller around Z axis.Ĭonst FRotator Rotation = Controller->GetControlRotation() Ĭonst FRotator YawRotation(0, Rotation.Yaw, 0)Ĭonst FVector fwd = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X) Now I have a bigger or smaller room, I won’t be affected because the vector is “normalized”, of length 1. So, you can define a unit vector (vector of length 1, where 1 is the length of whichever unit you choose). When you say (2, 3, 4), what does 2 mean? 2 cm? 2 m? Maybe you counted how many tiles? Maybe we shouldn’t care! If you do that and tell me your rotation, I’ll point my airplane to that direction as initial condition, instead of pointing it to the TV, and then I apply rotation. For example, the AirplanePicture = (2, 3, 4). You can do that, and everybody will understand what you mean, as long as you can describe AirplanePicture line in terms of X,Y, Z. You want to describe a rotation with respect to the vector pointing from the airplane to the picture. ![]() Previously, we described the rotation along X, Y, and Z which everybody agrees to. You make the airplane point towards that picture. Now assume you have a picture somewhere on the wall. This is possible because we defined a “Reference Frame” and “Rotation Operation” which rotates an object from its initial position. Now, to tell another person the orientation, you can send them the numbers (APRoll, APYaw, APPitch). Rotate the airplane from its INITIAL POSITION up from the floor by 30 degrees, around the Y axis.Rotate the airplane from its INITIAL POSITION to the right of TV by 45 degrees, around the Z axis (This is Yaw).Call it APRoll for (AirPlaneRoll) for example. Rotate the airplane from its INITIAL POSITION around its body or its x-axis.Take call this position of the airplane: INITIAL POSITION.Point the airplane towards the TV with wings parallel to the floor (Decide a frame of reference).How do you tell another person how this airplane is “oriented”, or where it is pointing to, if the room has nothing but a TV? Now, imagine you have an airplane toy, and you are in a room with a TV. Rotating around z axis is called Yaw (like you rotate a screw driver for example). Rotating around the y axis is called Pitch. ![]() Rotating around x is called Roll (Think of how an airplane Goes from this – to this / when it wants to turn) Go to and search for “pitch roll yaw” for good explanation. Now, for the same 3D object, you can rotate an object around each of x, y, and z axis. You can move from any point (x1, y1, z1) to another (x2, y2, z2). If you have a 3D object in 3D world, you can move long each of x, y, and z axis. Rotation matrix is for rotation, not “translation”. I will give an explanation, hopefully you can ask the right question.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |