Contents
How to draw a quad around it center game?
You’re drawing the quad relative to the lower left corner, so in order to match the center of the quad with the object space origin, you should first translate it by ( -width ()/2, -height ()/2, 0 ). Keeping in mind that matrices are multiplied in the reverse order, I would try something like:
Is it possible for an object to rotate about any axis?
An object can rotate about any axis. However, in the case where the axis does not go through the center of gravity, we would typically decompose this motion into a movement of the object’s center of gravity, combined with motion about the center of gravity. You can always do this.
How to rotate objects around their own center?
Assuming that your PICKFIRST is set to 1 and the Text/MText is all Middle or Middle-Center justified then this is fairly easy. Have the Properties Dialog box open (CTRL+1) Select the Text/MText (or select all, and use the little pulldown at the top to only select the Text objects) and then change the rotation to 180.
How to define local space for a quad?
Local space is the space in which you define your vertex positions. For instance, if you draw your quad using the opengl glvertex* commands, you should specify each vertex relative to (0, 0, 0):
How to calculate the rotation of the x axis?
For instance, imagine that you see the following values in the debugger: [ 0.7 0 0 0.7 ]. x=0.7, it’s bigger than y and z, so you know it’s mostly a rotation around the X axis; and 2*acos (0.7) = 1.59 radians, so it’s a rotation of 90°.
Can you use a quaternion in GLSL for skeletal animation?
In some cases, you might actually want to use quaternions in GLSL, for instance if you do skeletal animation on the GPU. There is no quaternion type in GLSL, but you can pack one in a vec4, and do the math yourself in the shader. How do I convert a quaternion to a matrix ? You can now use it to build your Model matrix as usual:
When to use quaternions or Euler angles in 3D engine?
Euler angles are intuitive for artists, so if you write some 3D editor, use them. But quaternions are handy for programmers, and faster too, so you should use them in a 3D engine core. The general consensus is exactly that: use quaternions internally, and expose Euler angles whenever you have some kind of user interface.