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

17
votes
1answer
7k views

Orienting a model to face a target

I have two objects (target and player), both have Position (Vector3) and Rotation (Quaternion). I want the target to rotate and be facing right at the player. The target, when it shoots something ...
17
votes
0answers
683 views

How can I compute a Jacobian matrix with dual quaternions? [closed]

I'm trying to understand an inverse kinematics algorithm realized with dual quaternions as presented here. My Jacobian matrix, however, seems to be calculated wrong. Could somebody explain, ...
16
votes
5answers
4k views

How can you visualize a quaternion?

When I visualise a three dimensional rotation matrix, or scaling matrix I visualize it as three axes. Is there a similar way that I can visualize a rotation quaternion?
13
votes
3answers
5k views

How do I implement a quaternion based camera?

UPDATE The error here was a pretty simple one. I have missed a radian to degrees conversion. No need to read the whole thing if you have some other problem. I looked at several tutorials about this ...
12
votes
6answers
5k views

Math topics for 3D graphics programming

I understand that the following math topics are required for 3D graphics programming. I have started doing some of them in my math course. Can someone point me in the direction of a resource that ...
11
votes
2answers
1k views

Why do people use quaternions?

I have been using them as a black box for a while, I'm just learning about of the maths but I'd just like some definitive answers to this question. So far the only benefit I've come across personally ...
11
votes
1answer
2k views

Quaternions and rotation around world axis

Disclaimer: I am a professional games programmer, and use quaternions most days but they are close to black magic to me. I am relatively at home with math but imaginary numbers always confused me. I ...
11
votes
1answer
916 views

Moving an Object along a Curve while Rotating it

I woud like to move an object along a curve. At particular points on the curve, I wish the object to change speed and rotate itself along its axis. Imagine an airplane flying to a destination. It has ...
11
votes
2answers
2k views

Arbitrary Rotation about a Sphere

I'm coding a mechanic which allows a user to move around the surface of a sphere. The position on the sphere is currently stored as theta and phi, where theta is the angle between the z-axis and the ...
9
votes
2answers
4k views

How can I rotate about an arbitrary point in 3D (instead of the origin)?

I have some models that I want to rotate using quaternions in the normal manner, except instead of rotation about the origin, I want it to be offset slightly. I know that you don't say, in 3d space, ...
7
votes
3answers
2k views

How to keep my Quaternion-using FPS camera from tilting and messing up?

I am using an FPS-like camera, and it uses quaternions. But, whenever I try looking up and then sideways, it tilts, and sometimes it can turn upside down. How can I fix this?
7
votes
3answers
369 views

Slerping rotation mirrors

I rotate my game character to watch at the target using the following code: transform.rotation = Quaternion.Slerp(startQuaternion, lookQuaternion, turningNormalizer*turningSpeed/10f) ...
7
votes
3answers
739 views

Routes on a sphere surface - Find geodesic?

I'm working with some friends on a browser based game where people can move on a 2D map. It's been almost 7 years and still people play this game so we are thinking of a way to give them something ...
7
votes
2answers
1k views

Calculating a quaternion so a bone points in a specified direction

In an attempt to solve this question, I decided to figure out the absolute (world space) directions of each joint in the source pose (as normalized unit vectors), and then rotate the joints of the ...
5
votes
1answer
224 views

Walking on a sphere

I'm working on a game which involves walking your character on the surface of a sphere. Using the answer to Arbitrary Rotation about a Sphere, I've written my code as: if (game.isKeyDown(37)) { // ...
5
votes
2answers
546 views

How do I extract a translation vector from a dual quaternion?

I'm trying to do some things with rigid body dynamics using dual quaternions (these are not the same thing as normal quaternions!) and I'm so close to getting things to work. The problem I'm having is ...
4
votes
5answers
3k views

Rotating vector3 by a quaternion

I am attempting to rotate a vector3 by a given quaternion. I know that this is true v' = q * v * (q^-1) I know that q^(-1) is the inverse which just -q/magnitude(q), but how do I map the ...
4
votes
3answers
778 views

Problem representing torque as a quaternion

Euler angles are much more intuitive to me than quaternions for representing 3-dimensional rotations. In fact, I barely understand quaternions at all. I use quaternions for rotation because people ...
4
votes
2answers
312 views

Method for interpolation between 3+ quaternions?

I'm currently using spherical linear interpolation (slerp) to interpolate between two quaterions with a weighted value. But, I'm having a difficult time coming up with a method to interpolate between ...
4
votes
1answer
485 views

Why game engines usually don't offer a vector3.rotate method? [closed]

Game engines like Three.js, Ogre3d and Unity3d often don't provide a default rotate method on their vector class. You usually have to do something like: rotated = vector.applyQuaternion( new ...
4
votes
2answers
744 views

Matrix interpolation for animation blending

I use the XNA Animation Component library to perform blending between animations. It uses spherical linear interpolation between matrices. In most cases this works without problems. However, I have ...
4
votes
2answers
3k views

How do I correctly use dual quaternions for rotation and translation of an object?

Up until now I've handled a given object's rotation and translation separately using normal quaternions for rotation and vectors for translation. However I'd like to use dual quaternions to handle ...
4
votes
1answer
113 views

Quaternion handedness issue

At least I think it is. I have the following functions: kmQuaternionRotationAxis - Constructs a Quaternion from an axis and angle kmMat4RotationQuaternion - Constructs a 4x4 matrix from a quaternion ...
4
votes
1answer
650 views

Arcball Problems with UDK

I'm trying to re-create an arcball example from a Nehe, where an object can be rotated in a more realistic way while floating in the air (in my game the object is attached to the player at a distance ...
3
votes
4answers
262 views

Why not use vectors to represent orientation?

From what I've read, people mostly use either quaternions or 3x3 matrices to represent 3D orientations, while plain vectors are used for angular velocity/momentum. Since we can use vectors to ...
3
votes
1answer
298 views

Rotations and angular velocity

I'm new to 3D-game programming and I'm having some trouble making objects rotate the way I want them to. I just read Glenn Fiedler's tutorials on game physics, awesome stuff by the way! ...
3
votes
2answers
333 views

Rotating voxels in 3d space amongst the x axis

I have a very simple voxel engine and so far it works based on coordinates, e.g. x, y, z. I was wondering if there is a formula for rotating groups of voxels/coordinates from the x axis(e.g. [0, 1, ...
3
votes
2answers
256 views

Calculating transform of arrow model pointing at some point in 3D space

I'm working on a 3D flight game and I'd like to implement a simple "navigation arrow" pointing at the next waypoint in world which the player has to fly to. I have position of both airplane (=camera) ...
3
votes
1answer
371 views

D3DXMatrixDecompose gives different quaternion than D3DXQuaternionRotationMatrix

In trying to solve this problem, I tracked down the problem to the conversion of the rotation matrix to quaternion. In particular, consider the following matrix: -0.02099178 0.9997436 -0.008475631 0 ...
3
votes
2answers
640 views

Quaternion understanding

I have some understanding problem concerning quaternions. In order to have my world object rotate in the correct way, I need to invert their quaternion rotation while refreshing the object world ...
3
votes
1answer
121 views

What is the rationale behind this method of computing the w-component from MD5 mesh files?

In tutorials regarding the MD5Mesh format, like this one, we often see code like float t = 1.0f - (q.x * q.x) - (q.y * q.y) - (q.z * q.z); if (t < 0.0f) { q.w = 0.0f; } else { q.w = -sqrt ...
3
votes
2answers
2k views

Quaternion rotation

I have a problem understanding quaternions rotation in OpenGL. So far I have implemented all function and operators related to quaternions.They are definitely working right!. However I can't find ...
3
votes
1answer
129 views

Inertia Tensor and World Coordinate conversion

I understand that the inertia tensor is basically a 3x3 matrix. I'm modelling a cube, and the inertia tensor for this shape has values for moment of inertia on the main diagonal of the matrix. All the ...
3
votes
2answers
277 views

Using quaternions, how do I determine if an object is upside down from an original rotation?

Imagine this scenario: An object is laying flat on a horizontal surface, from this an original rotation is determined. Then the object is moved, and at some point flipped upside down and put back down ...
3
votes
1answer
470 views

Rotating and Translating a Node in Horde3D with Matrices and Quaternions

I have been trying to learn how to use the Horde3D rendering engine for the past couple of days, and so far I have managed to learn a decent amount and integrate Bullet Physics with it as well. My ...
3
votes
2answers
474 views

How to derive euler angles from matrix or quaternion?

Currently working on steering behavior for my AI and just hit a little mathematical bump. I'm in the process of writing an align function, which basically tries to match the agent's orientation with ...
3
votes
1answer
271 views

Smooth Camera Offsets

I am attempting to implement a sort of, smooth camera that has angle offsets from the player as they turn, creating a cinematic effect as well as visual feedback for when the player turns. Here is an ...
3
votes
1answer
137 views

How to map absolute Joystick position to object rotation?

In my (Ogre) 3d scene I have an object that should be rotated locally based on Joystick input. I have a Joystick with min/max values of [-32767, 32767] on both X and Y axes. When the Joystick is in ...
3
votes
1answer
862 views

Quaternion Look At with Up vector

I have implemented a "look at" method for my screen elements and it almost works how I want it to work. The ScreenElement class uses a R3 Vector and a Quaternion to determine the position and ...
3
votes
1answer
1k views

Convert rotation from Right handed System to left handed

I have Euler angles from a right handed system that I am trying to convert to a left handed system. All the information that I have read online says that to convert it simply multiply the axis and ...
3
votes
0answers
382 views

Setting Orientation of Character in Bullet/Ogre [closed]

I've been suffering from an issue regarding the implementation of orienting characters in a game I'm implementing using Ogre3D and Bullet physics. What I have: A Direction Vector that the character ...
2
votes
3answers
509 views

How should I model exact 90-degree rotations in 3D?

I'm familiar with quaternions... have used them in the past to model arbitrary rotations in 3D, as for a plane flying around with full pitch/yaw/roll freedom. Works great. Now I'm working on a 3D ...
2
votes
3answers
490 views

Create quaternion based on where a unit is hit (shield effect as in Starcraft 2) [duplicate]

I'd like to implement a shield effect like that done for Protoss units in Starcraft 2. I'm guessing that the technique involved uses a partial sphere that is rotated to reflect where a unit is hit. ...
2
votes
2answers
705 views

Rotate model using quaternion

Currently I have this to rotate my 3D model that rotates on it's local axis independent from the world's axis: // Rotate model with Right Thumbstick modelRotation -= pController.ThumbSticks.Right.X * ...
2
votes
1answer
227 views

Moving an object toward another object on sphere knowing their quaternions

I have a sphere centered in world origin. On the sphere surface I have two objects and I know their quaternions (rotation around sphere). Currently my movement works on Vector2 inputs (cannot change ...
2
votes
2answers
1k views

Quaternions - how to limit axis?

Is there any possibility to limit quaternions to move only in x & y axis (like in Eulers- yaw and pitch, without rolling)? I's there any equation or something similar to do this? Some example: ...
2
votes
1answer
982 views

Quaternion Camera Orbiting around a Sphere

Background: I'm trying to create a game where the camera is always rotating around a single sphere. I'm using the DirectX D3DX math functions in C++ on Windows. The Problem: I cannot get both the ...
2
votes
2answers
62 views

What are “local” and “global” rotations?

Each node in jME3 has local and global rotations, which can be expressed in quaternions. What are they? Documentation has no clues, about in which state rotations are zero?
2
votes
1answer
33 views

Can I use quaternions and do a partial multiplication?

I have some code that rotates an object around an axis. It does this by creating a quaternion for a rotation and then multiplying by the old orientation: nextRot = QuaternionRotationAxis( axis, ...
2
votes
2answers
876 views

Quaternion based rotation and pivot position

I can't figure out how to perform matrix rotation using Quaternion while taking into account pivot position in OpenGL.What I am currently getting is rotation of the object around some point in the ...