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
0 votes
0 answers
33 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
32 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
45 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
36 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
101 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
94 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
0 votes
0 answers
40 views

Aligning joystick direction based on Up direction of object

THE SETUP: I’m working in Unity. I’m making a vehicle that can drive on walls. Its up direction aligns with the normal of the surface it’s driving on. The vehicle can move in any non-vertical ...
TheOtter's user avatar
1 vote
1 answer
65 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
34 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
99 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
75 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
0 votes
0 answers
123 views

rigid body 3D physics simulation: how to move from Euler to Runge-Kutta (RK4) integrator?

I have followed Physics for Game Developers to implement a basic vehicle simulation (3D Vectors and Quaternions) involving thrust and fluid drag and lift. But it explodes in steady state (some values ...
handle's user avatar
  • 121
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
232 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
31 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
37 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
  • 261
0 votes
0 answers
82 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
183 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
697 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
0 answers
66 views

Using Quaternion.LookRotation but keep target upright

I have a Game Object with a camera on it. I'm trying to aim the camera at a target but also trying to keep the target pointing up the correct way in the camera's view. In this case its an image or ...
ProbablePrime's user avatar
0 votes
1 answer
65 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
51 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
423 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
806 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
637 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
730 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
  • 31
1 vote
1 answer
60 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
91 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
846 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
698 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
538 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
145 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
346 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
477 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
34 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
199 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
62 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
55 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
291 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,183
0 votes
2 answers
147 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
169 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
  • 143
3 votes
0 answers
110 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
66 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
39 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
766 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
344 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
339 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
2 votes
1 answer
489 views

LookRotation function for Z-up, right handed system

I am rendering graphics myself using OpenGL, therefore I need to implement math library myself. I am looking for function Quaternion::LookRotation(forward, up), ...
Andy's user avatar
  • 123
0 votes
1 answer
436 views

Calculating world position with parent and child transform with translation and rotation

I have two Quaternion transforms, and a viewmatrix. These are custom transforms made by Dice, and I'm working on some custom modding for an older version of Battlefield. Now, I don't have the entire ...
Ben's user avatar
  • 103
0 votes
1 answer
174 views

Callback to a dynamic value in GameObject.transform

I'm currently writing an InputManager using Unity's "new" input system. The InputManager receives all player input ...
Jesse Williams's user avatar

1
2 3 4 5
8