Questions tagged [quaternions]

Unit quaternions are a mathematical representation of 3D rotations. They have 4 dimensions (one real and 3 imaginary) and can be represented as follows: a + i b + j c + k d or in terms of axis-angles: q = cos(a/2) + i ( x * sin(a/2)) + j (y * sin(a/2)) + k ( z * sin(a/2)) where: - a=angle of rotation. - x,y,z = vector representing axis of rotation.

A quaternion is a representation of a rotation from one coordinate frame to another coordinate frame. The mathematical relationship is given below:

If we have a quaternion:

q =  qw + i qx + j qy + k qz ;

The direction cosine matrix that represents the same rotation is given by:

   | 1 - 2*qy2 - 2*qz2   2*qx*qy - 2*qz*qw  2*qx*qz + 2*qy*qw |
   | 2*qx*qy + 2*qz*qw   1 - 2*qx2 - 2*qz2  2*qy*qz - 2*qx*qw |
   | 2*qx*qz - 2*qy*qw   2*qy*qz + 2*qx*qw  1 - 2*qx2 - 2*qy2 |

More information:

1469 questions
-1
votes
1 answer

Unity 3D: Change rotation with normalized vector3

Right now it seems the only way to rotate a game object is to input the rotation based on degrees. Is there a way to rotate a game object using a normalized Vector3, where its x,y,z are between -1 and 1. I have tried just multiplying the Vector3 by…
Bob
  • 105
  • 1
  • 9
-1
votes
1 answer

Rotate the y in a quaternion? Work arounds?

float speed = 20.0f; float rSpeed = 200.0f; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { float xValue = Input.GetAxis("Horizontal"); float zValue =…
-1
votes
1 answer

manually change a rotation in unity

So here is my problem : I have an object in Unity that is my Player. I want this Player to be able to face the direction where he is moving. but I don't know how to rotate an object until the specific key is released and then repositioning the…
-1
votes
1 answer

How would I rotate an object based on four vector3 points?

Im currently working on procedural animation trying to understand the fundamentals and how to implement it better. I am stuck trying to work out how to rotate the body of this Quadruped based on its legs. I understand I would have to get the…
-1
votes
1 answer

How to divide by Quaternion in Unity

Using this tutorial https://www.youtube.com/watch?v=waEsGu--9P8&list=PLzDRvYVwl53uhO8yhqxcyjDImRjO9W722 and Quaternions I've made a function, that finds the World Position of the grid tiles for Isometric Tilemap. private Vector3 GetWorldPosition(int…
Anton Makarov
  • 562
  • 3
  • 12
-1
votes
1 answer

Rotating an object to face a certain point, but only on one axis

I have objects that I want to rotate towards a collision point, but only on the Y-axis. Here's what I mean: The arrows show which direction the balls hit the pins. First The object rotates on it's Y-axis to face the collision point. Second I…
-1
votes
2 answers

Understanding quaternions in Unity

Having some difficulty in understanding how to use rotation (represented as a quaternion) in Unity. What I want to do is note the rotation of an object at some time, then find out its new rotation shortly later, and turn that into how many degrees…
nmw01223
  • 1,611
  • 3
  • 23
  • 40
-1
votes
1 answer

How to rotate cubee by quaternion in three.js?

I have some problems with understanding of how to rotate the figure by a quaternion. Can somebody please explain how to do it? In function render I want to rotate cubes by quaternions function main() { const canvas =…
IWProgrammer
  • 155
  • 1
  • 9
-1
votes
1 answer

Swift SCNAction, rotate to a quaternion

I have a planeNode in a SceneKit Scene which I want to control. For this I want to constantly update the Orientation. Due to the Singularities of Euler Angles I am using Quaternions. So far I am directly updating planeNode.orientation and it works…
alexismue
  • 29
  • 5
-1
votes
1 answer

How to calculate velocity from accelerometer and gyroscope?

Currently, I am working on a project where I need to calculate the certain Gait Parameters. Experiment Setup: I have two sensors placed on the shank(near the ankle) of each leg. Each sensor consists of the timestamp, accelerometer, gyroscope and…
-1
votes
1 answer

how to control Eigen Precision

I'm trying to convert an Eigen 3x3 rotation matrix to a quaternion using this code: //m_labelMatrix : raw data of vtk4x4 matrix4d. //m_transformationMatrix : Eigen4x4 matrix4d. m_transformationMatrix = Eigen::Map(m_labelMatrix); …
user5725581
-1
votes
1 answer

Issues with rotation matrix

I'm currently working on the intermediates between a physics engine and a rendering engine. My physics engine takes in a series of forces and positions and returns a quaternion. I am currently converting that quaternion into a rotation matrix using…
Peter
  • 33
  • 7
-1
votes
2 answers

How to calculate the signed angle between 2 vectors with a given axis normal in 3D?

Suppose if I have two vectors, A and B, and an axis (normalized vector), how do I find the angle between A and B such that the angle difference between A after rotation(axis, angle) and B wrt to the given axis is 0. A doesnt have to be equal to B…
user80667
  • 64
  • 6
-1
votes
2 answers

Issue with limiting the rotation of an object on Z-Axis

I'm pretty new to unity and i use it in a special way of creating a non-game2D application So i work only with UI element. I'm having some issues with something i want to do . I have an object which rotate following the finger (or mouse) but the…
-1
votes
2 answers

ROS Rviz visualization of Tango Pose data

We have modified sample code for the C API so Tango pose data (position (x,y,z) and quaternion (x,y,z,w)) is published as PoseStamped ROS messages. We are attempting to visualize the pose using Rviz. The pose data appears to need some…
1 2 3
97
98