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

0
votes
1answer
26 views

Strange quaternion rotation

I was implementing some quaternion rotations in too my infant 3d game engine and the rotations were really strange? Excuses my cluelessness. Anyways this is what I have: static XMVECTOR ...
0
votes
2answers
74 views

Quaternion Rotation Help

So I'm making a little engine with DirectX 11 and C++. (Some other help from other API's as well) DirectX has this function XMMatrixRotationQuaternion(XMVECTOR quaternion). I know nothing about this ...
4
votes
0answers
279 views

Why do these quaterion multiplications produce different results?

I am trying to use quaterions to modify the camera direction vector. This code works perfectly: glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x * mouse_sens * time_step), ...
3
votes
1answer
105 views

glm direction vector rotation

I'm working on a flight simulator, but I'm stuck with my airplane orientation. I tried some things but noone worked correctly. This is what I have : To be able to move it and roll it around himself, ...
0
votes
2answers
119 views

Quaternion rotation, translation, scale or 4x3/4x4 matrices for Skeletons?

I'm modding a game that uses 4x3 and 4x4 matrices to make skeletons, but I saw that an skeleton can also be made with a quaternian rotation and vector translation and scaling. What's the difference ...
0
votes
0answers
45 views

JBullet quaternion to Euler angle conversion causes strange flipping behavior

I am making a game using JBullet (a Java port of C++'s Bullet library) for the physics and LWJGL for the graphics. However, JBullet measures angles in quaternions and LWJGL uses Euler or ...
2
votes
2answers
70 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?
1
vote
1answer
133 views

How do I create a camera?

I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it. I have read about quaternions ...
0
votes
1answer
116 views

Repelling a rigidbody in the direction an object is rotating

Working in Unity, I have a game object which I rotate each frame, like so: void Update() { transform.Rotate(new Vector3(0, 1, 0) * speed * Time.deltaTime); } However, I'm running into problems ...
0
votes
2answers
60 views

Convert vector interpolation to quaternion interpolation? (Catmull-Rom)

I have some existing code which does catmull-rom interpolation on two vectors (facing and up). I'm converting this to use quaternions instead (to replace the two vectors). Is there a general way to ...
2
votes
1answer
34 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
1answer
102 views

Unity - Quaternion - Rotate / Unrotate Error

I'm trying to unrotate a quaternion, aligning it with the axis, and then rotate it back to where it was originally. But with every iteration it seems to lose precision and just after 20 iterations the ...
0
votes
1answer
188 views

How do I make an object's y-axis align with a Vector3?

I have a golf ball on the ground, and from a raycast, I have the normal which gives me the slope of the ground by the ball. I have an object which is rendered on the HUD to show that slope to the ...
0
votes
0answers
77 views

rotating sprite with quaternion in scenegraph

I have been trying to set up a scenegraph in XNA, which I then use to draw sprites in the correct places. It uses matrix transformations to accomplish this. So far, I got position and scale working ...
2
votes
0answers
104 views

Quaternion - rotating rigidBody to particular angle over time

Using Bullet Physics. There's a rigid body that is rotated. For some delta-time I need to rotate that body to have rotation of (0, y, 0) - keep the old y value rotation but reset x and z. The ...
17
votes
0answers
684 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, ...
1
vote
1answer
130 views

Custom lookAt function goes wild

I have written a custom lookAt function based on a lot of posts from all over the net, and it works very nice... except when a rotation (which is stored in a quaternion) crosses some 'threshold'. ...
0
votes
0answers
64 views

GLM Rotating Combining Multiple Quaternions?

I have a camera which I want to control with my mouse. I want the mouse to control the pitch and yaw of the camera but not the roll. To avoid loss of significance, I am storing the quaternions for ...
1
vote
1answer
222 views

How can I restrict the rotation of an object to a subset of axes using quaternions?

I've got a question about quaternions in my WebGL application. How can I rotate an object only around two axes? For example, how can I exclude/nullify rotation about the Y axis? The problem is that ...
0
votes
1answer
102 views

Strange quaternion camera streching in WebGL

So after a lot of researching about quaternions I almost got the quaternion camera working. Almost, cause it rotates in a proper way only in a vertical axis. Other rotations stretches and deforms the ...
2
votes
1answer
238 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 ...
0
votes
0answers
44 views

How to move objects flat on different planes in 3d?

I need to move objects in circular/square/sinusoidal patterns in a flat manner on a collection of different and rotating planes in 3d space. I have the perpendicular of the planes. One method is to ...
3
votes
1answer
276 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
356 views

How to get plane rotation by known normal vector

I have a FPP quaternion Camera and Plane with known normal vector. I want to find the orientation of this Plane so I can replace it to the Camera orientation to put the camera forward vector to a ...
3
votes
1answer
146 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 ...
0
votes
6answers
805 views

Quaternion Lerp never reaches target

I seem to have misunderstood something about how LERP works. Im not sure what is missing. The object is rotating as it should, but it cant seem to get it to end. The transform.rotation dont seem to ...
1
vote
2answers
192 views

How can obtain the relative orientation between two quaternions?

How do I obtain the relative orientation given two orientations (represented by quaternions q0 and q1)?
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 ...
0
votes
2answers
255 views

Rotate GameObject on click

I'm trying to get a card to flip when clicked but the flipping only works the first flip. While debugging, I can see that OnMouse is called every time I click. public class CardController : ...
3
votes
4answers
273 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 ...
0
votes
1answer
114 views

up vector for quaternion

First, I know there's a question exactly like mine, and some ohter really close, but my implementation of the solutions didn't work at all. Ok, now to the question. I created some forms of camera ...
1
vote
1answer
308 views

Making player movement direction follow players facing direction

if (controller.isGrounded) { moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical")); moveDirection = ...
0
votes
1answer
847 views

Quaternion LookAt for camera

I am using the following code to rotate entities to look at points. glm::vec3 forwardVector = glm::normalize(point - position); float dot = glm::dot(glm::vec3(0.0f, 0.0f, 1.0f), forwardVector); ...
1
vote
1answer
1k views

glm quaternion camera rotating on wrong axis

I'm trying to get my camera implemented with a glm::quat used to store the rotation. However, whenever I do circles with the mouse, the camera rotates along the axis I am viewing (i.e. I think it's ...
7
votes
3answers
372 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) ...
1
vote
1answer
452 views

Correct rotation with Quaternion

I have some problems with a rotating marble. I've tried it with Matrix.CreateFromYawPitchRoll and Matrix.CreateRotation but there were some problems, I think it's due to the Gimbal lock effect. So, ...
3
votes
2answers
299 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 ...
4
votes
2answers
351 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 ...
3
votes
1answer
305 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! ...
0
votes
1answer
108 views

2D vector to Quaternion

I have a 2D vector (with only X and Y), and my engine only supports orientation through Quaternions. How do I translate a 2D vector to a quaternion? The X and Y represent the direction (so X = 0 ...
5
votes
1answer
233 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)) { // ...
1
vote
1answer
396 views

Quaternions, Axis Angles and Rotation Matrices. Which of these should I use for FP Camera?

After 2 weeks of reading many math formulas and such I know what is a Quaternion, an Axis Angles and Matrices. I have made my own math libary (Java) to use on my game (LWJGL). But I'm really confused ...
2
votes
0answers
235 views

Quaternion to direction vector - flipping

I've kinda solved this myself by adapting the Camera::setDirection code from OGRE to work for my need: Now I have the following code: Vector3 boneDir = getBoneWorldOrientation(mEntity, mHips) * ...
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 ...
3
votes
1answer
381 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 ...
0
votes
1answer
315 views

Mouse Aiming Causing Rotation Jitter

When our game's ships move around, mouse aiming causes them to shake around a lot. The body being aimed is moved kinematically. I think we've narrowed it down to this block of mouse tracking code. ...
1
vote
0answers
130 views

How to set object's / node's absolute rotation correctly?

Usually when I want to rotate an object/node in my Ogre scene I call the node's rotate() method. That rotates the node locally relative to it's current rotation. So for example, when I start with 0 ...
3
votes
1answer
141 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
488 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
1answer
122 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 ...