Skip to main content

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 vote
0 answers
41 views

Quaternion.Euler acting weird

so I'm building up a simple arcade racing game and I was messing around with the Wheel Colliders setup. I was wondering if it was possible to add some camber adjustments in real time depending on the ...
Danilolilo's user avatar
0 votes
1 answer
86 views

Comparison of 2 different quaternion axes

I am trying to compare the Z-axis and the X-axis of two different quaternions in a way that would give me the Euler angles about the X and Y axes to line up the two different axes. In my program, the ...
ACR115's user avatar
  • 1
0 votes
2 answers
195 views

Why are Quaternions better than Euler-Angles for Godot (when to use which)?

Sorry about the click-bait, I know there are many many reasons why Quaternions and Bases are better than using Euler-Angles. Anyone on a 5 second google search could easily know why! But I am trying ...
ZenPyro's user avatar
0 votes
2 answers
74 views

How to rotate spaceship quaternion to face target direction with constant angular speed?

I have an enemy spaceship, and I want to make it turn to face the player with (for now) a constant angular speed. The ship's orientation is a quaternion. How do I do this? Since this is totally free ...
Tachytaenius's user avatar
0 votes
1 answer
63 views

How to get difference in rotation between 2 objects, but only on one axis

Say I have 2 cubes that start with the same rotation. I wish to track the rotation difference between the 2 about the z (forward) axis. Such that if cube A remains stationary and cube B rotates 30 ...
ThatOneGuy's user avatar
0 votes
1 answer
36 views

Usage of 'World rotation quaternion'?

While debugging the code that decomposes the world matrix, I found that the decomposed world rotation value is different from the world rotation value stored in Transform. Simply, World Rotation is ...
Tee Mo's user avatar
  • 3
0 votes
0 answers
154 views

Correct order on accumulating rotations

Suppose I have an Arcball camera that rotates up/down and sideways based on mouse input. After doing some research, I discovered that the correct way of calculating the new orientation is to do it the ...
CheeseS's user avatar
0 votes
2 answers
62 views

Quarternion rotation flattening cube

I am trying to rotate a cube using a quaternion matrix with WGPU. However, whenever I try to rotate it, I end up with I am using the matrix from https://en.wikipedia.org/wiki/...
CyberFlow's user avatar
0 votes
1 answer
103 views

Smartphone tilt calculation when using gyroscope in Unity (smartphone moving problem)

I have been trying for several days now to set up the correct behavior of the gyroscope in Unity. I want to make it so that when the smartphone is tilted, the object tilts along the z-axis. I found ...
Operator's user avatar
0 votes
1 answer
45 views

Orient a player mid-air to their predicted landing orientation in Unity?

Ever played Skate 3? When dropping into a ramp, or if you're midair, your player's up direction aligns to the normal of the surface you're about to land on, while respecting the player's forward ...
LeytonMate's user avatar
0 votes
2 answers
161 views

3D First person Rotate Character Unity

I'm facing the problem that my chacter is spinning around itself when I try to move, that's because Im trying to make my player move in the direction of the camera, but when I move it keeps rotating ...
Jamelaumn's user avatar
0 votes
0 answers
345 views

Convert a quaternion from NED right handed to ENU left handed

My drone's camera rotation is calculated using NED Right handed quaternion and I want to convert it to ENU left-handed.
rushikesh_n's user avatar
1 vote
1 answer
174 views

How do you rotate an object that uses a quaternion to represent orientation in 3D from a 3 vector input with values from a gamepad?

I'm using unity3d to create a six-degree of freedom flying game. The game takes in input from a standard dual-stick gamepad (like the Logitech f310). In unity each of the gamepad's joystick's axes are ...
RhinoPak's user avatar
0 votes
0 answers
47 views

Visualising quaternions for key frames in an editor

I'm working with 3D models from an existing game with its own proprietary file formats, however the way they work is pretty standard: Skeleton is defined as a set of bones, each bone either has a ...
nigelg's user avatar
  • 1
0 votes
1 answer
190 views

How to rotate a player to orient their up with a landing normal?

I'm making a skateboarding prototype in Unity, and like in skate 3, I'd like the player to sort of "align" gradually to their predicted landing slope. I've written the code that gets the ...
LeytonMate's user avatar
0 votes
1 answer
154 views

glm::eulerAngles gives unexpected output for quaternion

I used the euler->mat4->quat to give the right result, but euler->quat gives the wrong result - is there something I did wrong? ...
Zero Skyline's user avatar
1 vote
0 answers
24 views

I have a wind simulation in Unity, and i need to rotate an arrow to show the wind direction [duplicate]

I have this code that creates random vectors, which are used in the AddForce to push rigid bodies around. ...
Foneet's user avatar
  • 31
0 votes
1 answer
495 views

How can I calculate the translation used for rotating an object with a quaternion in Unity, to use for OpenGL?

In Unity, whenever I rotate an object, it also performs a translation. If I simply try to draw a quad with the quaternion used in Unity, it appears off because of that missing translation unity ...
hexley's user avatar
  • 5
0 votes
0 answers
33 views

How can I rotate 2 objects based on connection points?

I have 2 objects, each with GameObject children which are empty objects that I call snap points. These snap points represent where the original objects can connect together. They are positioned to ...
Lazar Wolfe's user avatar
0 votes
1 answer
56 views

How to encode homogeneous transformations on the root node of a gltf

Let us say we have a gltf asset. Let us say we want to apply an arbitrary linear transformation to the root node. We will say that the root node has a rotation, translation and scaling components. For ...
Makogan's user avatar
  • 260
0 votes
0 answers
189 views

6DoF camera control with a toggleable gimbal/horizon line lock and auto-upright button

I have a smooth 6DoF controller from following a tutorial (this is the tutorial) and tweaked it to be exactly what I want with a few exceptions. I found myself wanting the ability to lock the horizon ...
Mazz1224's user avatar
1 vote
0 answers
337 views

How do I use Transform.RotateAround to gradually rotate my GameObject around a new pivot in the shortest direction?

Given a normalized Vector2 or eulerAngles.z, I'm trying to gradually rotate a 2D box around a new pivot (the top of the box) ...
Ginger and Lavender's user avatar
1 vote
1 answer
999 views

How do I increment a quaternion rotation in update()?

When working with rotations expressed as angles, it makes sense to be able do to something like void GameLoop::update(){ pawn.rotation.x += 0.01; } And slowly ...
TaylorE's user avatar
  • 359
0 votes
1 answer
92 views

Yaw rotation not translating to Quaternion

I'm trying to implement the gimbal lock fix described in this question, but I end up getting weird behavior where when I rotate on the X axis (or try to at least) it rotates on both the X and Y axis ...
CaptainLupa's user avatar
0 votes
1 answer
67 views

How to rotate two transforms to touch at a point, while preserving forward direction?

I have a transform which I need to point one of its axes in the direction of another game object, without disturbing or rotating the other axes in any way. Consider the way your hips move around on a ...
DIGITII's user avatar
  • 58
1 vote
1 answer
761 views

How to make a concisely, elegantly, and human-friendly Quaternion camera?

I have spent three weeks struggling with the quaternion camera! Now I have two Implementations. One has some kind of gimbal lock issue or something like that. Another one is totally anti-human ( I ...
potter john's user avatar
0 votes
1 answer
2k views

Compute the difference between two quaternions and iterate with the difference

I would like to solve this with quaternions: A - B = C for(int i = 0; i < 10 ; i ++){ B += C/10 }; I want to get the difference (C) between two quaternions ...
利维坦's user avatar
0 votes
1 answer
1k views

How does Unity's FromToRotation work? A major part of its behavior seems undocumented

All Unity's documentation states about what FromToRotation does is: Creates a rotation which rotates from fromDirection to toDirection. This seems to leave a ...
user1999728's user avatar
1 vote
1 answer
1k views

Calculate normal and plane orientation using 4 3D points

I have 4 points as Vector3 in 3D space that shape a plane. How can I calculate the plane normal direction these four points create together, and express it as a <...
Cyclone's user avatar
  • 41
1 vote
1 answer
79 views

Rotating a command relative to the body of a drone

Suppose you have a drone the shape of a cube with rotors on each face, it's completely unable to control its roll-pitch-yaw, but it can accelerate along any of its 3D orthogonal vectors (see image ...
SMITHY's user avatar
  • 11
0 votes
1 answer
116 views

Rotate 'left' from the perspective of the space ship

I'm stuck on the following math problem for my game project. I have a space ship which position and orientation is saved in the following class: (The examples are in C# using types from the System....
Roy T.'s user avatar
  • 10.2k
1 vote
1 answer
2k views

How to change quaternion when flipping X axis?

For a given animation with the set of 3D coordinates of every joint and corresponding global rotations quaternions Q(X, Y, Z, W) in right-hand coordinates (Y-up, X-...
FunnyJingl's user avatar
0 votes
1 answer
1k views

Get object rotation around the x axis

I have an object which can be rotated at 0, 90, 180, 270 degrees. I am using this to get the rotation data: transform.eulerAngles.x However that code keeps ...
theCodeHermit's user avatar
1 vote
1 answer
851 views

How is the GLM '*' operator on quaternion and vec3 defined?

Using the definition of quaternion rotation given here: So the equivalent code in GLM of the above formula would be like this: ...
peter's user avatar
  • 21
0 votes
1 answer
269 views

Converting local rotation data from one rig onto another of a different orientation

I have an animated object which consists of a set of linked transforms. Think of them as bones. This object is animated - external to my software - and an API streams the local rotations - as ...
Bart's user avatar
  • 161
0 votes
1 answer
498 views

How to rotate a sphere on its axis with a tilt?

How can I simulate a planet's rotation on the Z axis but tilted x° ( similar to how the Earth's rotation axis is tilted 23° relative to its orbit). I know with Euler angles I'll meet some gimbal lock ...
Slater's user avatar
  • 105
1 vote
1 answer
958 views

Applying incremental rotation with quaternions: flickering or hesitating

I'm having a couple of problems while rotating an object every frame with GLM. First problem I'm trying to rotate the object with a small increase using quaternion multiplication. ...
Daniel Marques's user avatar
0 votes
1 answer
39 views

How to find "roll" relative to horizontal

To avoid gimbal lock, I use quaternions for my rotations. For example, to roll I use this function: ...
Olexy's user avatar
  • 103
0 votes
1 answer
264 views

Is Quaternion math really practical knowledge for a graphics programmer?

I've recently had a graphics programmer interview and I was asked about math that is under the hood of quaternions. I briefly mentioned the formulas of using quaternions as rotations, but the ...
The Dreams Wind's user avatar
0 votes
1 answer
102 views

writing a custom Quaternion.FromTo

I'm using the new Unity.Mathematics library. I'm trying to to replace Quaternion.FromTo(Vector3 from, Vector3 to) which returns a quaternion with what it would take ...
Charly's user avatar
  • 742
0 votes
0 answers
77 views

Aircraft rotations in 3d game

It seems like rotating plane in 3d game on certain axis is not solution because they change based on current rotation. Also there is gimbal lock problem, so i guess i should use quaternions. Is there ...
Olexy's user avatar
  • 103
0 votes
1 answer
422 views

Issue with rotating character's spine bone in the late update

I want to make my character's spine rotate to look up and down. It's animated, so I have to rotate in the LateUpdate, not Update. The only I need to do is just simply rotate the chest bone through the ...
modernator's user avatar
  • 1,213
0 votes
2 answers
196 views

Unity Follow Object Movement in Local Space?

I have two objects in my scene each at different positions and rotations in the scene. In this example, object A (the leader) moves according to controls. I need object B (follower) to follow the ...
MidnightCoffee's user avatar
0 votes
1 answer
282 views

NVidia Physx get yaw pitch roll from rigid body orientation

I am using NVidia PhysX in the game that I'm developing and I stumbled upon a math problem. I need to retrieve Yaw, Pitch and Roll from the orientation quaternion stored in the rigid body of some ...
Mike F's user avatar
  • 93
3 votes
0 answers
163 views

How do you compute for angular spring physics for physics joints in game engines?

I'm working on fixing Godot's physics joints. Currently, it uses Euler angles and it doesn't help me in building active ragdolls for my game. I heard that using quaternions is the way to go. So I ...
PHO BOSS's user avatar
0 votes
1 answer
79 views

How to calculate accelation times and vector to orient a pointmass to a new orientation

I'm trying to design a space game where the user has 2 types of input: forward and backwards thrust in the current direction change orientation The game is based on actual physics, for the sake of ...
Matti Kettu's user avatar
0 votes
1 answer
42 views

Relationship between equal-magnitude quaternions with different components

What is the relationship called between two quaternions that are equal in magnitude, but different in component values? They are not necessarily unit quaternions.
shawn_halayka's user avatar
0 votes
2 answers
1k views

Smooth rotation to target with separate yaw, pitch and roll smooth times

I'm trying to write a camera script in Unity that would smoothly rotate the camera over time towards the desired rotation, with separate input parameters for yaw, pitch and roll smoothing, and I can't ...
Kirby5's user avatar
  • 1
0 votes
1 answer
449 views

Quaternions and Euler Angles

I have made a simple animation in blender where the object(Bone in this case) is rotated from 0 to 360 degrees within 40 keyframes I then exported that data(Each keyframe) to glTF which stores the ...
Suic's user avatar
  • 119
0 votes
0 answers
415 views

How can I make the character rotate slowly with the joystick?

I am using two Joysticks. One for the character's movement and rotation and the other for the character's rotation and shooting. On the joystick I use for movement and rotation, the character turns ...
gunza's user avatar
  • 13

1
2 3 4 5
8