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

3
votes
1answer
940 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 ...
4
votes
1answer
507 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 ...
1
vote
2answers
232 views

Accumulating rotations for camera

It seems there are three ways to store a camera's rotation: in angles, view matrix or quaternion. I was using euler angles since when I used a matrix it had a tendency to accumulate rounding errors ...
2
votes
1answer
242 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 ...
3
votes
2answers
268 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) ...
4
votes
1answer
120 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 ...
0
votes
4answers
211 views

How much to modify yaw? XNA 4.0 [duplicate]

Heres a picture that explains better than my words can For rotating an object I'm using quaternions. CreateFromAxisAngle(vector3.Right,yaw) Maybe this isn't how I should be doing it but I also ...
0
votes
1answer
2k views

Rotating Objects in OpenGL: glRotate or Quaternions?

I'm coding my first engine and I'm trying to have performance in mind since I'll probably use it for mobiles, and I have this question, should you use glRotate or Quaternions for rotating objects in ...
-5
votes
1answer
572 views

How can I create a WebGL camera based on quaternions?

I am trying to create a WebGL camera based on quaternions. I looked at many tutorials, and none is as simple as it could be or it was not working. How can I create such a camera?
4
votes
2answers
785 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 ...
1
vote
2answers
400 views

Quaternion Camera

Can someone help me figure out how to use a Quaternion with the PerspectiveCamera in libGDX or in general? I am trying to rotate my camera around a sphere that is being drawn at (0,0,0). I am not sure ...
1
vote
1answer
579 views

Using Quaternion in libGDX

Can someone give me an explanation about how to use the Quaternion class in libGDX to move my camera around a sphere or just set it up, manipulate it, and apply it general? I am trying to acheive ...
7
votes
3answers
773 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 ...
1
vote
1answer
553 views

How to get a point to the left/right of a vector

I have a position vector of a point in space and a quaternion for it's rotation. What i'm trying to calculate is a point too the left and a point to the right. I have the position and ...
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 ...
2
votes
2answers
933 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 ...
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 ...
2
votes
2answers
1k views

Rotating a child shape relative to its parent's orientation

When rotating a shape using a quaternion value I also wish rotate its child shape. The parent and child shapes both start with different orientations but their relative orientations should always be ...
0
votes
1answer
346 views

(Quaternion based) Trouble moving foward based on model rotation

Using quaternions, I'm having trouble moving my model in its facing direction. Currently the model moves can move in all cardinal directions with no problems. The problem comes when I rotate the move ...
2
votes
2answers
733 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 * ...
3
votes
1answer
387 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
512 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
2answers
349 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, ...
1
vote
2answers
2k views

Rotation matrix derived from quaternion is opposite of expected direction

When I calculate a rotation matrix from a quaternion, it seems to be in the opposite direction. For instance: For a rotation of +45 degrees about the Y-axis, I would expect to get the following ...
1
vote
3answers
334 views

Inverting matrix then decomposing gives different quaternion than decomposing then inverting the quat

I'm getting different signs when I convert a matrix to quaternion and invert that, versus when I invert a matrix and then get the quaternion from it: Quaternion a = Quaternion.Invert(getRotation(m)); ...
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
433 views

Finding a suitable axis-angle to avoid gimbal lock

In OpenGL the camera faces the -z axis with the +y axis pointing up. I am using quaternions to represent the orientation of my objects (which works well) and am trying to do the same for the camera. I ...
0
votes
1answer
381 views

Rotation matrices from Quaternion.Identity and -Quaternion.Identity are the same?

If I create a rotation matrix from an identity quaternion then it is the same as a creating it from a negative identity quaternion Matrix m0 = ...
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?
2
votes
1answer
1k 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 ...
3
votes
1answer
277 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 ...
0
votes
1answer
307 views

Quaternion to axis-angle, or ripping apart a full transform matrix

My game entities currently hold a quaternion for their orientation with the ability to return either a 3X3 full rotation matrix (based on that quaternion), or a full 4X4 transform matrix. though what ...
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 ...
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 ...
3
votes
0answers
389 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
1answer
851 views

Rotating a vector by a quaternion

I am trying to rotate a direction vector (0,0,1,0) by a rotation quaternion in DirectX. From what understanding, to rotate the vector you must do NewVector = rotQuaternion * Vector * ...
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 ...
2
votes
1answer
1k views

Flip rotation matrix

I'm doing character control with kinect. I need to mirror the joint orientation because the character faces the player. Somehow by Googling through internet I've done it and everything works very ...
4
votes
1answer
682 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 ...
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 ...
0
votes
1answer
441 views

Rotate an existing quaternion around an axis?

I have an existing quaternion (Java Quat4f). I would like to rotate this quaternion around an axis (i.e. 90 degrees around the x axis, 25 degrees around the y axis, 10 degrees around the z axis, 180 ...
0
votes
2answers
2k views

from normal to rotation matrix

(i'm on OPENGL) i have a mesh O (object) and a mesh T (terrain). i know a single triangle in T and i want to orient O to be aligned to that triangle (torate O to align to T in that point). i have ...
1
vote
1answer
2k views

how to create a Quaternion from an Orientation Vector in xna

i have a Vector3 represents an Orientation in 3D , how to convert it to the corresponding Quaternion ? is there any quick way ? EDIT : i want to add an angular velocity vector to the Orientation ...
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 ...
2
votes
2answers
962 views

Why is my quaternion camera rotating around strange axes?

I can't get it to work for the life of me. Its rotating the camera in the global coordinate system, or some other random coordinate system, not the camera local coordinate system. WASDEC work ...
5
votes
2answers
557 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 ...
1
vote
2answers
493 views

How can I orient a projectile along its flight path?

I have a projectile that is moving around the world (in a ballistics trajectory right now). I am currently keeping track of its position and velocity. I want to draw it oriented to its velocity, so ...
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 ...
9
votes
2answers
5k 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, ...
2
votes
3answers
525 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 ...