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.

learn more… | top users | synonyms

1
vote
4answers
69 views

How can I min-max quaternions?

What I'm doing In my engine, I'm trying to implement a camera that will follow a target object, such as a player. I wanted to avoid just simply using the inverse of the target's transformation, ...
0
votes
1answer
53 views

Problem with Quaternions and Unity's Euler Angle Convention

So I want to rotate an UI-Element according to my magneticHeading, I just want to apply the magnetic heading to the z rotation in EulerAngles. So I tried to do so, which brought me to some weird ...
1
vote
0answers
35 views

Rotation of a point around axis using quaternions

I have a simple processing program to rotate a point around arbitrary axis but it stops after a bit. I'm trying to get full rotation of the point around the axis. import ...
1
vote
1answer
37 views

Adding quaternions is useful?

I'm working with quaternions and matrices 4x4 and 3x3, and I have a doubt. I think that adding and multiplying quaternions is the same that converting the quaternion to a matrix, do the operation and ...
0
votes
1answer
14 views

Set up a basic D3DXQUATERNION

I'm trying to set up a D3DXQUATERNION to operate a rotation of 90 degrees around the Y axis. I tried in the following way: D3DXQUATERNION tempRot1(0.0f, 1.0f, 0.0f, cos(XM_PIDIV2/2)); because in ...
0
votes
2answers
42 views

Quaternion not giving correct value back. What am I doing wrong here?

Right so I made a quaternion and assigned it a value but it reports back the wrong value. Here is the relevant code... Quaternion LeftTurnLimit = Quaternion.identity; float test = 0.1f; ...
0
votes
0answers
17 views

Camera movement on a sphere, and how to look while doing it

I am trying to make some kind of pointerlocked walking simulator that involves movement of the camera on the inside of a sphere. I've looked at Walking on a sphere, but that solution fights what I'm ...
3
votes
2answers
91 views

Why does transforming a Vector3 by a Quaternion result in reversed Z?

I'm trying to transform the vector (1, 0, 0) by an orientation unit quaternion, which in XNA should be: Vector3 v = Vector3.Transform(Vector3.Right, Orientation); But this results in the Z value ...
0
votes
1answer
30 views

Rotate smoothly object to angle (Y axis) of the collided object

Well, let's say I have two planes, one which I am moving, and another one that I collide with, that has a different y rotation. I want to make that, once both planes collide, the plane the user ...
0
votes
1answer
32 views

Limit Quaternion/vector3 axe in a certain interval

I have some trouble to understand, and handle Quaternion and Vector3. I'm improving the tutorial Tank of Unity: EDIT: Because a video explain so much better, there is a link to the 30 secondes video ...
0
votes
0answers
28 views

How to rotate with quaternions

I need to simply rotate around an axis, but because unity uses quaternions for calculating i have issues with converting into euler angles. When i ask for rotation of an object in euler angles it ...
0
votes
0answers
49 views

How to get correct quaternion value from real world to screen?

I'm writing an application (not a game per se, but close enough) where we use attitude sensors (an IMU) in the real world to affect the orientation of an object in the application's 3D space (OpenGL). ...
0
votes
1answer
78 views

Unity Change Ball Direction after hitting paddle in a Pong game (like in dx-ball)

I'm struggling with how to get the ball to change the bounce based on where it hits on the paddle. Normally in a pong game, the angle changes, depending on how far from center the ball bounces, and ...
0
votes
1answer
116 views

360 degree quaternion interpolation?

I am in the process of implementing interpolation into a simple game loop I am playing with after reading the infamous "fix your timestep" article (which is amazing by the way). I have the position ...
0
votes
1answer
105 views

Rotation around arbitrary vector (using quaternions?)

I currently have a camera which orbits a specific target object, always looking at it. The user can drag the mouse to move the camera left/right/up/down and the camera will move over the surface of a ...
0
votes
1answer
52 views

Rotate object with mouse look script

I would like to rotate an FPS camera slightly upwards during a shot as an effect of recoil, but the problem is that I have a mouse look script as well and I assume it prevents me from achieving the ...
1
vote
1answer
146 views

Unexpected quaternion rotation behavior

First off let me apologize for the vague title but I really couldn't think of a more descriptive one (maybe after reading this a more advanced user might be able to edit it). Alright, so I have been ...
0
votes
0answers
79 views

How to programmatically create an animation that linearly interpolate between two rotations?

I would like to programmatically create an animation that linearly interpolate between two angles (using the shortest path). I wrote the following code : Animation anim = ...
0
votes
2answers
79 views

Moving a ship forward from rotation

I am making a simple space simulator, where the player can control a ship using 2 controls, one for pitch and one for bank. The ship is properly rotated but I cannot figure out how to make the ship ...
1
vote
2answers
48 views

Increasing the rotation angle on a quaternion makes the rotation stop at a certain angle

I'm using the following code to change the rotation of an object: Quaternion rot = getRotation(); setRotation(make_quaternion_axis_angle(rot.v,rotationSpeed*dt)*rot) This code works as expected ...
2
votes
1answer
135 views

How to avoid Gimbal Lock on Rubik's Cube [duplicate]

I am making a Rubik's cube program. That will simulate a Rubik's cube. I am having problems with gimbal lock. I need to know how to avoid it. To my understanding I can either multiply the x, y, z ...
1
vote
1answer
43 views

Quaternion Types in Game Engine

I've recently been coding a quaternion class for my game engine and have run into a problem. Firstly, should I be using unit quaternions for my engine? Secondly, should I have the functions ...
1
vote
0answers
31 views

align local Y to be parallel with global Y during or after slerp

I am using the following function to have a globe rotate a point on its surface to face the global Z toward the camera. This works fine, but after each rotation the Y axis seen as a green line is not ...
2
votes
1answer
52 views

Rotating object around a rotating one?

I am developing a solar system animation in Unity3D. Planets rotates around sun. But ı have an issue simulating satellites like Moon. Moon should be rotating around world normally and moon should be ...
1
vote
1answer
87 views

Rotate camera with quaternion around axis going through the origin

I am trying to implement my own third person camera using quaternions in DirectX. I first wanted to check that the camera rotates as expected so I started to rotate it around the world y-axis (0,1,0) ...
1
vote
1answer
127 views

Quaternion rotation problems [duplicate]

I want to rotate my model and I have X and Y rotations. Here is my code: D3DXQUATERNION q, qrotation; D3DXQuaternionRotationAxis(&q, &D3DXVECTOR3(1.0f, 0.0f, 0.0f), ...
4
votes
1answer
150 views

Unity's Quaternion.Lerp slows down when target is directly behind turret

Software: Unity v5.2.1f1 Personal I am trying to achieve the effect of a turret in Unity. For this I have a turret consisting of 3 parts as well as a target. The problem is that whenever the target ...
2
votes
1answer
82 views

Euler adjustments between two quaternions

I have two quaternions, q1 and q2. If my object's current rotation is at q1, but I need to get it to q2, what would be the process to figure out how much rotation I apply to x, y, and z in order to ...
1
vote
1answer
85 views

Applying angular velocity to quaternion

I am reading Game Physics Engine Development by Ian Millington currently. In his book, he represent an orientation of rigid body by quaternion. I don't understand the formula where he apply angular ...
2
votes
1answer
39 views

How do you use the distributive law with Quaternions and vectors?

I'm trying to solve for the distance from Obj1 to Obj2 relative to Obj1, because I do not know their global positions, rotations, or the difference between their local spaces. Thankfully, they are ...
0
votes
0answers
102 views

Translation & Rotation Transform Hierarchy

I've struggled to find a hierarchical transform class in C++ that is similar to that of Unity's (without scaling) that uses quaternions as opposed to matrices. So I figured creating my own wouldn't be ...
0
votes
1answer
175 views

Quaternion.LookRotation() not rotating 360 degrees

In my scene I have two cubes one has a tag "Respawn" and another one has the following script attached: ` using UnityEngine; using System.Collections; public class NewBehaviourScript : ...
1
vote
3answers
75 views

How much to roll Z to make horizon level

I've got a flying camera with some arbitrary rotation. (It also has a translation, but that's not important.) It's flying along its local Z axis, traveling in some direction over the ground with ...
3
votes
0answers
110 views

3D 3-axes rotation into 3D 2-axes rotation

Hello everyone and thanks in advance to anyone who'll help me through this ! I am currently working on the Kinect V2 (for XBox One) to interact with an avatar. I'd like to use the rotation quaternion ...
1
vote
1answer
128 views

Quaternion rotations & transforms from global to local space

I am trying to solve this problem and getting no where, could really use some assistance. Rotation is defined as X (rotate left/right), Y(rotate up/down), Z(roll) Coordinates are X: Forward/backward, ...
-1
votes
1answer
144 views

Quaternion.Lerp not working properly in Unity3d

I'm using Quaternion.Lerp to rotate a joint with a certain angle, but when I use the below code I find the joint rotating very far although I specified it to rotate with only 5. Any thoughts please? ...
2
votes
1answer
156 views

Unity 3D - Rotate towards object with random offsets

Title is a little confusing, but let me explain: I want to make the enemies look at the player, and shoot at him, with random precision, meaning that one time the enemy will shoot a little bit to the ...
0
votes
1answer
115 views

Rotation in 3D space using Quaternion

System Configuration I have two simulation systems (which I am going to call Sim-A and Sim-B) where I am going to spawn an entity created in Sim-A inside Sim-B. Expected outcome The entity created ...
1
vote
0answers
43 views

Interpolate camera rotation over many keyframes smoothly

I have a defined set of rotation/position keyframes that I want a camera to animate between smoothly. Handling the position is easy enough using cubic bezier curves (and just auto-generating the ...
4
votes
1answer
172 views

Does converting quaternion to matrix cause a lot of overhead?

This is related to rendering creating a model, view, projection matrix for opengl. While matrix are fairly standard there's a lot of talk about using quaternions for rotations but why would u go from ...
1
vote
0answers
113 views

How to calculate a quaternion rotation between 2 vectors with a specific final up vector?

I know you can calculate the quaternion rotation between 2 vectors with something like this after all the optimizations: quat quat::fromtwovectors(vec3 u, vec3 v) { vec3 w = cross(u, v); ...
0
votes
0answers
488 views

Rotate model to face direction it's traveling in 3d with scenekit and swift - Boids implementation

I am implementing a boids simulation using Swift and Scenekit. Implementing the simulation itself has been fairly straight forward however I have been unable to make my models faces the direction they ...
1
vote
0answers
44 views

Quaternion camera in 3D space with Pitch and Yaw

I am having trouble implementing a quaternion camera that can fly freely in 3D space with only Pitch and Yaw rotations. It works fine except when you look up or down and then try to look left or ...
0
votes
1answer
738 views

Unable to stop navmeshagent for rotation before moving

I'm trying to get the NavMeshAgent to rotate before calculating a path and proceed walking. I stumbled upon a thread that said this can be done by manually rotating the object first. However, I am ...
0
votes
2answers
43 views

Getting unit to complete rotation before moving?

I've been trying to get a unit in my project to move in a fashion similiar to that of modern MOBA games. However, I am faced with the issue of the unit moving before the rotation is completed and the ...
0
votes
1answer
86 views

Rotation with respect to world instead of the object itself using Quaternion.Euler in unity

[Other answers on similar questions on stackexchange didnt help] This script is giving some weird outputs On running this script If I press rightarrow once followed by 's' the object rotates on 'z' ...
0
votes
2answers
4k views

Rotate an object smoothly by 90 degrees on key press in unity3D

[I saw few similar question on stackexchange but none is solving the purpose.] I want to rotate a 3D object by 90 degrees on different axis on respective inputs. For example if 'a' is pressed, the ...
1
vote
1answer
528 views

Quaternion Slerp and Lerp implementation (with overshoot)

I am working with Unity (C#) and was looking for an implementation of Slerp and possibly Lerp that allow overshoot (progress not strictly limited to 0..1 range). I want to do some tweening animation ...
1
vote
1answer
153 views

Correct way to integrate scaled axis angular velocity into a quaternion

Across my travels on the internet I have came across to ways of integrating a scaled axis angular velocity into a quaternion. The first way converts the angular velocity into an axis angle quaternion ...
0
votes
2answers
247 views

How to rotate (YAW) aircraft in XNA?

I'm developing a flight simulator based on Riemer's Blog tutorial (XNA C#). To control the aircraft, I use the following code: Quaternion additionalRotation = Quaternion.Identity; additionalRotation ...