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.

Filter by
Sorted by
Tagged with
0
votes
1answer
44 views

Get world object transform relative to another object (potential parent)

I'm attempting to parent a bullethole decal to a dynamic object. I've figured out how to set the correct position for the bullethole object so that it shows at the correct position of the dynamic ...
0
votes
0answers
17 views

What is the simplest way to rotate a 3D point arohnd another point given a quaternion?

I am weak in understanding quaternions however I am learning. Right now, I know how to rotate a point around another point given an angle represented by a Vector3 using a rotation matrix. However ...
0
votes
1answer
14 views

How can I rotate the two endpoints of a line around the line's center in 3d?

The object is a capsule. I have the position of the object vector3, and the orientation of the object, a quaternion. I want to construct a line which goes through the middle of the capsule with the ...
0
votes
2answers
44 views

Rotating quaternion smoothly with acceleration and deceleration

I have this code for my linear acceleration and deceleration. ...
0
votes
1answer
32 views

Angle between start and current rotation

I'm facing problem of the operations on rotations. I have a wheel with a start rotation of (0, 0, 0). The player has to rotate wheel 270 degrees in Y axis either left or right. During the rotation ...
0
votes
1answer
158 views

Understanding how to use Quaternion to rotate object

I m having hard time to understand Quaternions and to use them in my engine for rotating object. I m looking for step by step explanation, actually a correction of my view of Quaternions. Here is how ...
1
vote
3answers
107 views

Combining Quaternion Rotations

I'm trying to understand Quaternions in relation to rotation and orientation. As an example in learning, I'm trying to rotate a point (e.g. at [0.7071, 0, -0.7071], on the unit sphere) about the line ...
0
votes
1answer
54 views

Does gimbal lock occur only when a combination of local and world rotation axis are used?

In all the explanations I've seen of gimbal lock, they always refer to the fact that when performing a series of rotations on all axes, it is possible that one rotation might end up aligning an axis ...
0
votes
0answers
47 views

How to efficiently average multiple rotations (quaternions)?

So, I'm working on an animation system in C++, and am trying to blend multiple animations together. A slerp is easy on two quaternions, but is it efficient (or accurate) to chain together for more ...
0
votes
0answers
27 views

What is an efficient way to get a look-at direction from either a quaternion or a transformation matrix?

So, I have an object in my custom engine (C++), with a column-major transform in world space. I'm using a package that takes a look-at direction as an input. What's the most efficient way to get a ...
1
vote
1answer
39 views

Divide two quaternions evenly by a scalar to get a smooth rotation in-between

How do you divide two quaternions - say A and B - evenly by a scalar, to calculate the rotations between them to render a ...
0
votes
1answer
70 views

How to rotate velocity Vector3 to always point the same direction so that it can be applied to 2d blendtree?

Given two variables, a Vector3 representing body velocity and a Quaternion representing body's local rotation, how could I normalize the velocity vector so that it's always oriented towards the ...
0
votes
0answers
41 views

Rotate around an axis function for euler angles representation

For a 3d game i need a function to rotate an euler representation around an arbitary axis by an angle. For example an object is rotated with euler angles (0,90,0). Now the object should be rotated by ...
0
votes
0answers
28 views

Why does this order of Quaternion multiplication not introduce roll into my fps-style character controller?

I'm working on an OpenGL based project (in C#), employing Quaternions to rotate my camera I first tried to: ...
0
votes
1answer
170 views

Using Euler angles to rotate object 360 degrees

I'm trying to create script that rotates object in given axis by set amount of degrees. That's my 2 core methods ...
1
vote
1answer
108 views

Godot - Quaternion slerp is altering initial rotation of an object

I have a player that shoots a rocket. If the rocket has a target, I use a quaternion slerp to make it home in on that target. Free firing the rocket goes directly forwards as expected. Setting a ...
1
vote
1answer
17 views

Plane to always face object

How do i get a plane to always face an object with the flat/mesh/xy side? I tried sticking in Vector3. forward and up but i always get the plane facing the object on an edge. ...
0
votes
1answer
28 views

Move Object θ Degrees Over T Time

Note, this happens on click and not in the update cycle I have a game object that i rotate at a given angle, around a point without a time component like this(works as intended): ...
0
votes
2answers
72 views

How to rotate an object based on the movement and angles of Lifters

I have Lifters that "carry" an object. I want the object to move and rotate based on how those Lifters move. Requirements include: Supporting 1-4 Lifters at any side of the Object (e.g., ...
0
votes
3answers
65 views

How to calculate a direction that will turn a parent so that a locally-rotated child is faced in a given direction?

Imagine an old sailing ship with cannons: they're pointed out at 90° angles from the ship's hull, so in order to fire them, you have to turn the whole ship so that the cannons are pointed at the ...
2
votes
1answer
194 views

Clamp quaternion relative to plane normal

How would one be able to clamp a quaternion based on the angle relative to a plane surface (defined by a normal)? My diagram below provides more of a visual explanation of exactly what I am talking ...
1
vote
1answer
245 views

Euler angle and Quaternion conversion become weird when yaw is bigger than 90 degrees

I'm writing a camera which needs to change a quaternion to Euler angles than change them back, it only works when the yaw is less than 90 degrees, I wrote a example to check: ...
0
votes
2answers
43 views

Player is not looking at correct direction

My Enemy/Bot is facing the wrong direction as shown in the attached screenshot 1. Basically what I want is that Enemy/Bot gun should directly face the player, not enemy/Bot himself. Note: White line ...
1
vote
2answers
328 views

3D Camera Rotation (Unwanted Roll) - Space/Flight Cam

I am working on a camera class that will have full range of motion (pitch, yaw, and roll). When only altering pitch and yaw, I am getting a large amount of roll. I understand that the issue is ...
3
votes
1answer
240 views

Rotate quaternion around plane normal

How can one rotate a quaternion so that the rotation is around a plane normal? A graphic/diagram I made below gives more detail about what exactly I am implying. Note that the tip of the quaternions ...
0
votes
0answers
18 views

Quaternian coefficient multiplication

I have 2 quarternians (Q1 & Q2), I'd like to apply a coefficient to each Quaternian, where the sum of both coefficients = 1. As far as I'm aware, multiplying a quaternian by another is equivalent ...
0
votes
0answers
223 views

How do I determine the forward/right direction when I have the “up” vector? - Unity

I am trying to fix a gameobject for e.g. a cube (which i am using as a sensor) on my character. I need the cube to rotate (with orientation control from the inspector - I have a public quaternion ...
0
votes
0answers
36 views

Rotate rigidbody with angular momentum and direction to targetRotation

I'm creating a skier game in which the user can freely rotate in the air based on input. Roughly: ...
0
votes
1answer
62 views

Sensor quaternion to Unity conversion [duplicate]

I want to convert rotations given as quaternion from sensors to Unity. The sensors (documentation here) axis are the following ones: Unity is the following one: I don't know how to map axis other ...
0
votes
1answer
118 views

Handling rotation interpolation at 180 degrees

I currently have a scene where 3d a gents move throughout a grid, each time they move that can pick a random cardinal direction up,down,left or right. They then rotate to face that direction using <...
0
votes
1answer
235 views

How to replace Quaternion with Vector2 in Quaternion times Vector3 equation?

Edit: Having to edit this question extensively because DMGregory was right and there were unexpected consequences. I am working on local avoidance and pathfinding code for a 3D strategy game. It ...
0
votes
3answers
83 views

World rotation independent mouselook

Preface: I am terrible at using quaternions right. I wanted to create a world rotation independent mouselook script. That is, no matter the 'down' for the camera, the mouselook should feel natural to ...
1
vote
2answers
417 views

What is Unity Quaternion range?

I've read somewhere that a Quaternion in Unity ranges between [-1,1] values. I mean the individual XYZW values. Ex: new Quaternion(.1f,.2f,-.3f,-.4f) Is this true? More clearly: I know they take ...
1
vote
1answer
624 views

GLM conversion from euler angles to quaternion and back does not hold

I am trying to convert the orientation of an OpenVR controller that I have stored as a glm::vec3 of Euler angles into a ...
0
votes
1answer
68 views

Finding rotation quaternion from orthonormal basis?

Given three 3D unit vectors \$a\$, \$b\$, \$c\$ such that: \$a \times b = c\$ \$b \times c = a\$ \$c \times a = b\$ (ie \$a, b, c\$ form an orthonormal basis) How do we calculate a unit ...
2
votes
1answer
153 views

Slerp to slerp smoothing

p0 ------- p1 ------- p2 I am successfully slerping between 2 points (p0-p1; p1-p2). But the transition between two slerped angles (p1_in-p1_out) do not match, ...
0
votes
1answer
65 views

How can I match the delta rotations of two objects?

Here is the code I'm starting from: ...
0
votes
0answers
36 views

How do physics bones relate to animation bones?

Skinned animations use a tree of bones where the child bone (say a finger) is the weighted sum of the rotations of all it's parent bones. Physics bones are defined as a rotation matrix of a primitive (...
0
votes
1answer
163 views

Rotate an object on itself, from one random Quaternion to another

I have a situation: I have a 3D object in the world. let's say a sphere. I have 2 random directionnal vector: vector A, and vectorB: My question is: How to I rotate over time my object, from A to B ? ...
1
vote
3answers
101 views

How do I rotate a sphere so that a position on it comes to a specific location?

Sorry for my english. I added a picture to explain what i want. I want rotate Big Sphere to make the black point locate in front of camera. (to the white point's position) not black point moving, ...
0
votes
0answers
80 views

Generate random vector relative to current vector within a certain degree in 3D space

I'm creating a simple ray tracer and I think this would be the best place to ask. I've created my own engine in Go, and I've gotten pretty far. I am now implementing diffuse surfaces, so I'll need to ...
0
votes
2answers
432 views

Unity3D - Camera Jitters When Displacing and Rotating Smoothly

DISCLAIMER: I am using Unity 5.6.5f1 for this code, I honestly don't know if there would be API updates on later versions, though I don't think so. I tried to make a simple Third Person Camera that ...
1
vote
0answers
53 views

Adding vectors and applying rotation matrix using quaternion

I have a problem and looking for help, see attached image. I have a number of points (x,y,z) which are treated as connected vectors (first point as first vector base, second point as first vector end ...
0
votes
1answer
134 views

Quaternion.slerps resets camera rotation to (0,0,0) when i go to play mode help!

i am building a camera rotation script like in fps. Everything is setup and working except that camera rotation resets to zero at the start of game which i dont want. This is the camera rotation i ...
1
vote
1answer
275 views

Storing transformations in game objects. (GLM, C++)

I'm currently writing a game engine from scratch for learning purposes. I just started implementing transformations. I know how they work in general but I'm not sure how to implement them efficiently ...
0
votes
1answer
384 views

Quaternion rotation is inverse of what I expect

I'm trying to learn quaternions and decided to implement my own quaternion class. To test it I made a couple vertex shaders, one that gets a model matrix (calculated from the quaternion) and another ...
0
votes
1answer
93 views

Quaternion rotation around center, undefined behavior

Here's my code: ...
0
votes
0answers
79 views

Quaternion Rotation after performing previous rotations

Have Quaternion \$ Q\$ which is rotated on the \$X\$ axis 90 degrees. \$Q\$ is now \$ (0.707106, 0.707106, 0, 0)\$. I want to rotate \$Q\$ another ...
0
votes
0answers
61 views

Rotate a Vector by Quaternions

I'm trying how to work out how to Rotate a Vertex using Quaternions, using a scientific calculator, or on paper. Exam preparation. My lecturer has given us this; Quaternion = (-0.5, 0, -0.7071067, 0....
0
votes
0answers
31 views

From look-at vectors to a quaternion

So, I have code to create a quaternion from a matrix (using the 3x3 rotational part.) And I have code to construct a transformation matrix from a lookat + up vector pair. To go from lookat+up to ...

1
2 3 4 5
7