Questions tagged [quaternion]
Mathematical constructions, number systems. In 3D-graphics quaternions are used alongside vectors and matrices. One of the benefits of quaternions is that they overcome some rotational problems (known as gimbal locks) that are inherent to vectors and matrices.
394 questions
1
vote
1
answer
161
views
Understanding the math behind procedural aiming animation
I'm creating a procedural aiming animation system in UE5 as a learning experiment.
In order to position the hand for aiming down sights, I'm using a forward vector from player camera to project out a ...
2
votes
0
answers
84
views
How to convert a quaternion to another coordinate system where y and z are inverted?
I have quaternion representing a camera pose in a coordinate space called "World Frame 2":
x+ = right
y+ = up
z+ = out
...and I want to convert it to another space called "World Frame ...
0
votes
1
answer
183
views
Rotate vector by quaternion different formulas
I was implementing the rotation of a 3D vector by a quaternion, implementing the formula that I've found in this thread.
To testing my function, I've rotated some vectors by using MATLAB, in ...
0
votes
1
answer
168
views
Comparison of 2 different quaternion axes
I am trying to compare the Z-axis and the X-axis of two different quaternions in a way that would give me the Euler angles about the X and Y axes to line up the two different axes. In my program, the ...
0
votes
2
answers
176
views
How to rotate spaceship quaternion to face target direction with constant angular speed?
I have an enemy spaceship, and I want to make it turn to face the player with (for now) a constant angular speed. The ship's orientation is a quaternion. How do I do this?
Since this is totally free ...
0
votes
1
answer
71
views
Usage of 'World rotation quaternion'?
While debugging the code that decomposes the world matrix, I found that the decomposed world rotation value is different from the world rotation value stored in Transform.
Simply, World Rotation is ...
0
votes
2
answers
142
views
Quarternion rotation flattening cube
I am trying to rotate a cube using a quaternion matrix with WGPU. However, whenever I try to rotate it, I end up with
I am using the matrix from https://en.wikipedia.org/wiki/...
0
votes
1
answer
78
views
Orient a player mid-air to their predicted landing orientation in Unity?
Ever played Skate 3? When dropping into a ramp, or if you're midair, your player's up direction aligns to the normal of the surface you're about to land on, while respecting the player's forward ...
0
votes
0
answers
524
views
Convert a quaternion from NED right handed to ENU left handed
My drone's camera rotation is calculated using NED Right handed quaternion and I want to convert it to ENU left-handed.
0
votes
0
answers
81
views
Visualising quaternions for key frames in an editor
I'm working with 3D models from an existing game with its own proprietary file formats, however the way they work is pretty standard:
Skeleton is defined as a set of bones, each bone either has a ...
0
votes
1
answer
257
views
glm::eulerAngles gives unexpected output for quaternion
I used the euler->mat4->quat to give the right result, but euler->quat gives the wrong result - is there something I did wrong?
...
0
votes
1
answer
720
views
How can I calculate the translation used for rotating an object with a quaternion in Unity, to use for OpenGL?
In Unity, whenever I rotate an object, it also performs a translation. If I simply try to draw a quad with the quaternion used in Unity, it appears off because of that missing translation unity ...
0
votes
1
answer
98
views
How to encode homogeneous transformations on the root node of a gltf
Let us say we have a gltf asset. Let us say we want to apply an arbitrary linear transformation to the root node.
We will say that the root node has a rotation, translation and scaling components. For ...
1
vote
0
answers
383
views
How do I use Transform.RotateAround to gradually rotate my GameObject around a new pivot in the shortest direction?
Given a normalized Vector2 or eulerAngles.z, I'm trying to gradually rotate a 2D box around a new pivot (the top of the box) ...
0
votes
1
answer
132
views
Yaw rotation not translating to Quaternion
I'm trying to implement the gimbal lock fix described in this question, but I end up getting weird behavior where when I rotate on the X axis (or try to at least) it rotates on both the X and Y axis ...
2
votes
1
answer
1k
views
How to make a concisely, elegantly, and human-friendly Quaternion camera?
I have spent three weeks struggling with the quaternion camera!
Now I have two Implementations. One has some kind of gimbal lock issue or something like that. Another one is totally anti-human ( I ...
0
votes
1
answer
2k
views
How does Unity's FromToRotation work? A major part of its behavior seems undocumented
All Unity's documentation states about what FromToRotation does is:
Creates a rotation which rotates from fromDirection to toDirection.
This seems to leave a ...
1
vote
1
answer
112
views
Rotating a command relative to the body of a drone
Suppose you have a drone the shape of a cube with rotors on each face, it's completely unable to control its roll-pitch-yaw, but it can accelerate along any of its 3D orthogonal vectors (see image ...
1
vote
1
answer
2k
views
How to change quaternion when flipping X axis?
For a given animation with the set of 3D coordinates of every joint and corresponding global rotations quaternions Q(X, Y, Z, W) in right-hand coordinates (Y-up, X-...
1
vote
1
answer
1k
views
How is the GLM '*' operator on quaternion and vec3 defined?
Using the definition of quaternion rotation given here:
So the equivalent code in GLM of the above formula would be like this:
...
0
votes
1
answer
563
views
How to rotate a sphere on its axis with a tilt?
How can I simulate a planet's rotation on the Z axis but tilted x° ( similar to how the Earth's rotation axis is tilted 23° relative to its orbit).
I know with Euler angles I'll meet some gimbal lock ...
0
votes
1
answer
55
views
How to find "roll" relative to horizontal
To avoid gimbal lock, I use quaternions for my rotations. For example, to roll I use this function:
...
0
votes
1
answer
168
views
writing a custom Quaternion.FromTo
I'm using the new Unity.Mathematics library. I'm trying to to replace Quaternion.FromTo(Vector3 from, Vector3 to) which returns a quaternion with what it would take ...
0
votes
1
answer
521
views
Issue with rotating character's spine bone in the late update
I want to make my character's spine rotate to look up and down. It's animated, so I have to rotate in the LateUpdate, not Update. The only I need to do is just simply rotate the chest bone through the ...
0
votes
1
answer
394
views
NVidia Physx get yaw pitch roll from rigid body orientation
I am using NVidia PhysX in the game that I'm developing and I stumbled upon a math problem. I need to retrieve Yaw, Pitch and Roll from the orientation quaternion stored in the rigid body of some ...