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
1 answer
23 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 ...
user avatar
  • 103
1 vote
1 answer
42 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. ...
user avatar
0 votes
1 answer
23 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: ...
user avatar
  • 103
0 votes
1 answer
64 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 ...
user avatar
0 votes
0 answers
20 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 ...
user avatar
  • 713
0 votes
0 answers
31 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 ...
user avatar
  • 103
0 votes
0 answers
17 views

Problem in interpolating quaternion in networked game

I've tried to interpolate position and rotation of object between previous state and next state from server. Here's what I was doing. ...
user avatar
  • 3
0 votes
1 answer
26 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 ...
user avatar
  • 1,101
0 votes
2 answers
35 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 ...
user avatar
0 votes
0 answers
13 views

Convert between WCS and OCS using quaternions

I have been scratching my head for days understanding how to fully describe an object fully using just the normal vector and an insertion coordinate. Specifically this is for creating DXF files, but ...
user avatar
  • 101
0 votes
1 answer
25 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 ...
user avatar
  • 23
3 votes
0 answers
47 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 ...
user avatar
0 votes
0 answers
8 views

LookRotation while leaving the local Z-axis untouched [duplicate]

I'm creating a game where the player will move around on a small planet. I've created a script that rotates the bottom of a capsule (my player) to face the center of a sphere (the planet) using ...
user avatar
0 votes
1 answer
49 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 ...
user avatar
0 votes
1 answer
34 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.
user avatar
0 votes
2 answers
135 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 ...
user avatar
  • 1
0 votes
1 answer
84 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 ...
user avatar
  • 119
0 votes
0 answers
48 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 ...
user avatar
  • 13
2 votes
1 answer
141 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), ...
user avatar
  • 123
0 votes
1 answer
56 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 ...
user avatar
  • 103
0 votes
1 answer
39 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 ...
user avatar
0 votes
2 answers
168 views

Quaternions distorting object in Metal

I've been trying to get rotations with quaternions to work for a while now, and I feel I am very close to it actually working but I just can't get it to work. I do not have a view matrix yet and am ...
user avatar
1 vote
1 answer
62 views

How to rotate a 3D object based on stick Input and the normal of the ground's surface? (Unity3D)

I am making a game where I want to view an object from any angle and use an analog stick to rotate it according to this input and the surface the object is currently resting on. Here's a visualization ...
user avatar
1 vote
1 answer
43 views

Trigonometry to move an arm around axis in 3D space

Hello I have a question about rotating a Rod hinged to a fixed point (so it swings all around), and targets. short form, I would like to know how to find a rotation that would point my rod (while ...
user avatar
0 votes
2 answers
91 views

Rotating only 2 axes of rotation quaternion to "point" in a direction

Note: I am using the Unity DOTS ECS framework, which contains less maths functions, but I can probably implement the same functions from standard unity if the code is public. This question is not ...
user avatar
0 votes
0 answers
36 views

Slerp Quaternion Rotation

How do I rotate a box two different times? I want to rotate a box 45 degrees, then wait for 5 seconds, and finally rotate it 45 degrees backwards on the same Y-axis. The first rotation works, but when ...
user avatar
  • 1
1 vote
1 answer
41 views

Vector Rotation - Casting a Cone

I'm working on an obstacle avoidance system in unity, and my thought is to cast a sphere along the velocity; if it hits, draw a ring of spheres around that one and repeat until max ring count or a ...
user avatar
-1 votes
2 answers
115 views

Parent object does not rotate on its own axis with its children. How do I fix it?

My parent object components: Rigidbody2D and the script I shared below. Children(Head, Body, Arm, Backpack...): There is only collider. There is no rigidbody2D. (I want the parent object to use the ...
user avatar
  • 13
0 votes
1 answer
70 views

Character rotation jitters when looking around

I want my character to walk around sphere like a planet, so in my script I rotate it according to the normal of a raycast and I also rotate my character on the Y axis when I look around with the mouse....
user avatar
1 vote
2 answers
345 views

Reorientation when rotating Transforms around another Transform without parenting

The functionality I am trying to implement, consists of rotating one Transform and appling this rotation to other relevant Transforms in the scene. To make it a bit more clear: I have several objects ...
user avatar
2 votes
0 answers
56 views

Struggling with 3D math concepts. Would like practice [closed]

Hello fellow game developers! I graduate this October with my Bachelor’s of Game Programming and Development. I took the required Calculus and Linear Algebra. While I passed the classes I feel like I ...
user avatar
0 votes
1 answer
111 views

How to set transform.up without locking the y-axis?

I'm trying to make an object's transform.up to a normal of the raycastHit point. I tried using this line of code: ...
user avatar
  • 115
0 votes
1 answer
50 views

Find the vector orthogonal to a quaternion?

Apologies if the title doesn't quite make sense, it's been a long time since I did any 3D stuff. I would like to be able to pan my camera up and down with the arrow keys. The camera's rotation is ...
user avatar
0 votes
0 answers
62 views

LibGDX getting model roll

I'm working on a 3d game in LibGDX, got help on here with my model rotation. Worked great. But now I'm dealing with the model's roll, and it's not behaving as expected. It's controlled by: ...
user avatar
0 votes
1 answer
60 views

Quaternion.AngleAxis smallest value?

If I'm using an angle with a value of somewhat below 0.1 degrees in Quaternion.AngleAxis, the quaternion will not apply a rotation at all. Why is this?
user avatar
  • 448
-1 votes
2 answers
310 views

"Rotation Quaternions must be unit length" using rigidbody.MoveRotation in unity

I'm making a game that involves throwing things with catapults. The cup of a catapult needs to use Rigidbody.MoveRotation to let a ball respond to being thrown in ...
user avatar
0 votes
1 answer
154 views

How does Unity know where the character is facing?

I just learned Quaternion.LookRotation and it's used for rotating an object. I used it to face my character in the direction where it's moving, but I couldn't ...
user avatar
0 votes
0 answers
27 views

Rotating with a preferred direction [duplicate]

I do a RayCast to the terrain and then use the RaycastHit.normal to plant flags. I would like to have the flags to point up with the normal, but have them all face the same direction. As seen in the ...
user avatar
0 votes
1 answer
211 views

Get world object transform relative to another object (potential parent)

I'm attempting to parent a bullethole decal to a dynamic object. I've figured out how to set the correct position for the bullethole object so that it shows at the correct position of the dynamic ...
user avatar
  • 171
0 votes
1 answer
18 views

How can I rotate the two endpoints of a line around the line's center in 3d?

The object is a capsule. I have the position of the object vector3, and the orientation of the object, a quaternion. I want to construct a line which goes through the middle of the capsule with the ...
user avatar
0 votes
2 answers
142 views

Rotating quaternion smoothly with acceleration and deceleration

I have this code for my linear acceleration and deceleration. ...
user avatar
0 votes
1 answer
54 views

Angle between start and current rotation

I'm facing problem of the operations on rotations. I have a wheel with a start rotation of (0, 0, 0). The player has to rotate wheel 270 degrees in Y axis either left or right. During the rotation ...
user avatar
  • 27
1 vote
1 answer
731 views

Understanding how to use Quaternion to rotate object

I m having hard time to understand Quaternions and to use them in my engine for rotating object. I m looking for step by step explanation, actually a correction of my view of Quaternions. Here is how ...
user avatar
1 vote
3 answers
652 views

Combining Quaternion Rotations

I'm trying to understand Quaternions in relation to rotation and orientation. As an example in learning, I'm trying to rotate a point (e.g. at [0.7071, 0, -0.7071], on the unit sphere) about the line ...
user avatar
0 votes
1 answer
201 views

Does gimbal lock occur only when a combination of local and world rotation axis are used?

In all the explanations I've seen of gimbal lock, they always refer to the fact that when performing a series of rotations on all axes, it is possible that one rotation might end up aligning an axis ...
user avatar
  • 318
0 votes
0 answers
83 views

How to efficiently average multiple rotations (quaternions)? [duplicate]

So, I'm working on an animation system in C++, and am trying to blend multiple animations together. A slerp is easy on two quaternions, but is it efficient (or accurate) to chain together for more ...
user avatar
  • 3
0 votes
0 answers
35 views

What is an efficient way to get a look-at direction from either a quaternion or a transformation matrix?

So, I have an object in my custom engine (C++), with a column-major transform in world space. I'm using a package that takes a look-at direction as an input. What's the most efficient way to get a ...
user avatar
  • 3
1 vote
1 answer
121 views

Divide two quaternions evenly by a scalar to get a smooth rotation in-between

How do you divide two quaternions - say A and B - evenly by a scalar, to calculate the rotations between them to render a ...
user avatar
  • 166
0 votes
1 answer
123 views

How to rotate velocity Vector3 to always point the same direction so that it can be applied to 2d blendtree?

Given two variables, a Vector3 representing body velocity and a Quaternion representing body's local rotation, how could I normalize the velocity vector so that it's always oriented towards the ...
user avatar
  • 337
0 votes
0 answers
64 views

Rotate around an axis function for euler angles representation

For a 3d game i need a function to rotate an euler representation around an arbitary axis by an angle. For example an object is rotated with euler angles (0,90,0). Now the object should be rotated by ...
user avatar

1
2 3 4 5
8