Questions tagged [quaternion]

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.

Filter by
Sorted by
Tagged with
-1
votes
0answers
13 views

How to get quaternions for a rotation if only one axis is flipped in the co-ordinate system? [duplicate]

I have a quaternion representation of rotation and position in a co-ordinate frame which is right-handed and I want the corresponding rotation and position in another frame where the Y-axis is flipped ...
0
votes
1answer
58 views

Quaternion rotation is inverse of what I expect

I'm trying to learn quaternions and decided to implement my own quaternion class. To test it I made a couple vertex shaders, one that gets a model matrix (calculated from the quaternion) and another ...
0
votes
0answers
21 views

Quaternion rotation around center, undefined behavior

Here's my code: ...
0
votes
0answers
33 views

The X axis becomes the Y axis after a quaternion rotation

I am making a FPS game, and I have a for loop where I place out "ground" objects. (pseudo code) ...
0
votes
0answers
60 views

Quaternion Rotation after performing previous rotations

Have Quaternion \$ Q\$ which is rotated on the \$X\$ axis 90 degrees. \$Q\$ is now \$ (0.707106, 0.707106, 0, 0)\$. I want to rotate \$Q\$ another ...
0
votes
0answers
9 views

Rotated movement in Gear VR Unity

So the player can move in four direction - forward, backward, right and left. But the forward direction should be from wherever he turns his gear VR controller. I have tried the below code, but when ...
0
votes
0answers
30 views

Rotate a Vector by Quaternions

I'm trying how to work out how to Rotate a Vertex using Quaternions, using a scientific calculator, or on paper. Exam preparation. My lecturer has given us this; Quaternion = (-0.5, 0, -0.7071067, 0....
0
votes
0answers
72 views

How to rotate after a rotation in Godot / GdScript?

This 3D mesh is rotated by 45 degrees on the Y-axis. The camera follows the same rotation, resulting in these images Now I want to make the mesh rotating parallel to the camera. That is, if the ...
0
votes
0answers
21 views

From look-at vectors to a quaternion

So, I have code to create a quaternion from a matrix (using the 3x3 rotational part.) And I have code to construct a transformation matrix from a lookat + up vector pair. To go from lookat+up to ...
0
votes
1answer
43 views

How can I use slerp to stop my orbit camera “shortcutting” across to its target position?

I'm working on a camera that moves around the player at a fixed distance. It's the standard right-stick-to-move-cam-around kind. The camera follows the player but stays at a fixed angle to (0,0,1) ...
0
votes
1answer
19 views

Unity, errors when using Quaternion.Euler to copy rotations

In the game I'm creating I have a square that rotates around a parent point, I want the square to always aim upright however (think of a rotating platform). What I've done is simply use ...
2
votes
2answers
48 views

Rotate on one axis, but visibly keep the other axes stable and editable

It's been a long two weeks. Quaternions are freaking complicated. I've managed to make a few baby steps towards finishing my project, but I've hit a brick wall and could use a few of your beautiful ...
0
votes
0answers
35 views

Orientation is off when nearing 90 degrees rotation

Context: I am using Vive Trackers to track the head of a user. It is not a Vive headset and I am restricted to the TrackingUniverseRawAndUncalibrated, which only guarantees that the Y axis will be UP. ...
0
votes
3answers
74 views

In 2D, how can I improve character rotation using raycasts when dealing with sharp/convex edges?

Edit: After making some edits to my polygon collider (based on @Alex F's suggestion), I can indeed confirm that sharp, convex corners are causing the buggy ...
0
votes
1answer
30 views

Vertical camera rotation has reduced speed & range when looking at the character from the left or right

I completed a camera tutorial for Unity. I can rotate a camera around my figure around the Y axis (Vector3.up) and I wanted to extend that for a Fixed-Free 3rd Person camera (What are the types of 3rd-...
0
votes
1answer
40 views

Move a point to another, along an elipse

according to this picture, I want to move my yellow object, smoothly to the red one. And I want to have an eliptic trajectory in relation to my center point. So for now I'm having this code: ...
-1
votes
1answer
60 views

Rotation Problem in Mario galaxy like controller [duplicate]

i'm doing a Mario galaxy like CCC. And I have a serious rotation problem, may be Gimble lock, or maybe not. So first, I have a parent object ("PLAYER") who can rotate toward a planet: https://youtu....
0
votes
1answer
109 views

Unity smooth local rotation around one Axis, oriented toward a target

I want to acheive the same rotation you see in the inspector. In short: a smooth local Y rotation, toward a target I have a Vector3 orientation: ...
0
votes
0answers
101 views

Dual Quaternion - How to apply the dual quaternion as a transform (Without converting to a matrix)

I've been trying to implement dual quaternions for a bone system and I have a few questions about them. I started by reading the beginners guide to dual quaternions (link: http://wscg.zcu.cz/wscg2012/...
0
votes
2answers
55 views

Quaternion angle calculation

I'm working on a programming project, in this project I'm receiving an angle as a quaternion value, I partially understand how they work but I don't find any math to get the values I need. What I ...
1
vote
1answer
69 views

What are the semantics of these quaternion functions in XNA/Monogame?

I am having trouble understanding the semantics of some members of the XNA/Monogame Quaternion class. The docs are not helpful, and tutorials trying to explain ...
0
votes
2answers
237 views

Moving an object at an angle based on quaternion rotation matrix (c++)

I have been trying to figure this out for a while now, and can't seem to get a working method. I am building a space ship movement with the following movement keys: P = accelerate (move forward) A = ...
0
votes
1answer
86 views

How to align 2 IMUs' quaternions?

Suppose I have 2 IMUs that output 2 quaternions. I place one IMU on my left hand and another one on my right hand. I put both my hands flat on the table and point it forward to the same direction. ...
0
votes
1answer
53 views

Quaternion representing rotation from shoulder to hand

I am provided with 3 quaternions. One for the shoulder, one for the elbow, and one for the hand. What I want is to obtain a single quaternion representing the rotation from the shoulder to the hand, ...
0
votes
3answers
547 views

Creating orientation Quaternion from forward vector

Suppose that I have an orientation Quaternion Q, I can compute its forward vector from V = Q * Vector3.forward easily. ...
0
votes
1answer
61 views

Do all normalized quaternions represent valid rotations?

Basically, I'm getting a bug where the rotations in the animations seem to be skewing the model even though I'm normalizing them. I suspect that the rotations are showing the error, but not causing it,...
0
votes
1answer
80 views

Can you decompose a rotation into a rotation around an axis and a quaternion?

I have a rotation represented by a quaternion and I want to get a rotation angle around the forward axis together with another quaternion which will together represent the original rotation. The ...
-1
votes
1answer
82 views

How to calculate inverse of quaternion?

I would like to calculate Quaternion.Inverse(Vector3(45,85,96)); but I got error message ...
2
votes
1answer
203 views

Reconstruct Quaternion from 48 bit rotation data

I'm trying to reverse an animation file from a commercial multiplayer game, whose format was recently updated. The problem lies within joint rotation information, which changed from a 128bit format to ...
0
votes
1answer
69 views

How can I use a redundant axis of rotation to prevent gimbal-lock & calculate a position for that axis?

I have a theodolite-like device that is trying to track a point such that it's "Forward" is always facing that point. Here is a GIF of it working as of now. As expected, when the value of the Red ...
0
votes
1answer
38 views

Calculate quaternion rotations between two values

I have a quaternion Q1: X: -0.023995593190193176 Y: -0.4076451063156128 Z: 0.04357096180319786 W: 0.9117847681045532 and I have a keyframe value Q2 which is based on Q1: X: 0.176469 Y: -0.368251 Z:...
2
votes
1answer
230 views

Why do I need to offset my aim rotation angle by 90 degrees?

I have this simple code to rotate an object (gun barrel) towards a target object (rocket ship). The gun barrel rotates towards the ship but is always 90 degrees off. I have fixed this in my code as ...
1
vote
0answers
173 views

ANSI C (C11) math libraries? [closed]

I know there are a multitude of C++ math libraries out there, but my current project is C-only (C11). So far I've made due with writing my own matrix/vector functions, but now I need to do the more ...
0
votes
2answers
121 views

How to rotate object just like in the scene?

Look at this image, I selected an object and pivot is set to local: When I rotated selected object in the scene by X axis, it rotates exactly I wanted. But if I rotate axis from inspector or script, ...
2
votes
1answer
521 views

Unity: Particle System start rotation completely incorrect when set via C# script

I am trying to set the starting rotation of a particle system via c# script so that the particles orientate with another object in the scene. My particle system 3d rotation is set as follows: ...
2
votes
1answer
2k views

Converting a quaternion in a right to left handed coordinate system

I have a quaternion from an IMU that id like to represent in unity. The issue is that the sensor uses a right handed coordinate system while unity uses a left handed coordinate system. In order to ...
0
votes
1answer
59 views

Object is not rotating from right direction

im beginner to unity so im using this code to rotate object with mouse with max rotation of 35 degrees,it is working but it's only possible to rotate object if mouse is under of that object. here is ...
1
vote
1answer
93 views

How to smooth rotations?

I have a semi-regularly (15fps to 60fps) sampled source of position and orientation to which I am using dead reckoning to fill in gaps. However, I would like to smooth it further to eliminate any ...
2
votes
1answer
119 views

Pitch becomes yaw as camera gets near object

I have been having trouble with my camera, first encountering the roll tilt that is so many times asked... I fixed that issue by following the instructions at this link: Unwanted roll when rotating ...
0
votes
1answer
57 views

How do I represent a MD5-mesh bone (quaternion orientation)

Going off this link about the MD5Mesh file format, I see a bone is represented as: ...
0
votes
0answers
61 views

Calculate smooth transition between local space angles

I'm trying to calculate direction of moving character (to rotate it's animation). I have something like this: Character can have 4 cardinal directions. The rotation is calculated from the current ...
1
vote
0answers
23 views

Quat.AngleAxis broken on one axis

I have a scene in my game where you create your own designs by placing static meshes and manipulating their scales, positions, and rotations. For the rotations I'm using Quaterion.AngleAxis as so: <...
0
votes
1answer
102 views

Avoid rolling whith quaternion

I'm using a Look At function (idem as nasskov answer on this post) to orient a model: osg::Quat result = quatLookAt(normalize(velocity)); It works but may let ...
0
votes
1answer
558 views

How can I set only the players X rotation to 0 in Quaternion.Slerp in Unity?

I want to set the players X axis to zero while he is turning to the target Object but I dont get it to work. Code: public float rotationSpeed; ...
3
votes
1answer
723 views

Why is my model rotating opposite direction around the Y axis?

I have a simple scenario. I have a simple scene, and in it I'm drawing a grid and a model, with some axis for orientation. I noticed when I rotate the model about it's local Y axis, if I rotate the ...
0
votes
1answer
240 views

Unity wheel collider extra camber angle

I want to give the value of a camber to the wheel collider my game. When the car stops, there is no problem visually, but as the wheel rotates, the wheel makes odd rotational movements together with ...
1
vote
0answers
41 views

How to apply constraints to limb movements of a 3D human model?

I'm animating a 3D human model using playcanvas game engine according to the quaternion data provided by IMU sensors. How can I limit the movements of the limbs of the human model to avoid unrealistic ...
1
vote
3answers
882 views

How to make a 90 degree rotation happen over time

I'm trying to take a RotateAround function and make it happen over time. I've been tinkering with Quaternions to try and get it to work but I can't quite figure it out. This is the code: ...
0
votes
1answer
236 views

Calibration using quaternion

I have an external hardware which gives me quaternion values. Now I would like to calibrate the device at a certain position and show tilt variations from that position on the UI. For example, I have ...
0
votes
1answer
63 views

Restore object right vector to horizontal position using quaternions

I'm fairly new in gamedev mathematics and i have a problem i cannot solve on my own. I'm working on L-System tree generation engine and i'm having serious difficulities while trying to work out ...