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
1answer
35 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 ...
0
votes
2answers
42 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 ...
0
votes
0answers
32 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 ...
1
vote
1answer
31 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 ...
-1
votes
2answers
62 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 ...
0
votes
1answer
26 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....
1
vote
2answers
49 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 ...
1
vote
0answers
43 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 ...
0
votes
1answer
32 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: ...
0
votes
1answer
42 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 ...
0
votes
0answers
48 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: ...
0
votes
1answer
28 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?
-1
votes
2answers
90 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 ...
0
votes
0answers
5 views

ARCore: Differentiate between two planes detected in adjacent vertical walls in the room

I'm working on Vertical plane detection. When I'm pointing at wall 1 of my room, plane1 here is the vertical plane detected in wall 1... I'm recording the quaternion via this formula ...
0
votes
1answer
73 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 ...
0
votes
0answers
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 ...
0
votes
1answer
103 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 ...
0
votes
0answers
21 views

What is the simplest way to rotate a 3D point arohnd another point given a quaternion?

I am weak in understanding quaternions however I am learning. Right now, I know how to rotate a point around another point given an angle represented by a Vector3 using a rotation matrix. However ...
0
votes
1answer
14 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 ...
0
votes
2answers
78 views

Rotating quaternion smoothly with acceleration and deceleration

I have this code for my linear acceleration and deceleration. ...
0
votes
1answer
38 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 ...
0
votes
1answer
409 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 ...
1
vote
3answers
172 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 ...
0
votes
1answer
116 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 ...
0
votes
0answers
57 views

How to efficiently average multiple rotations (quaternions)?

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 ...
0
votes
0answers
30 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 ...
1
vote
1answer
55 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 ...
0
votes
1answer
85 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 ...
0
votes
0answers
51 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 ...
0
votes
0answers
35 views

Why does this order of Quaternion multiplication not introduce roll into my fps-style character controller?

I'm working on an OpenGL based project (in C#), employing Quaternions to rotate my camera I first tried to: ...
0
votes
1answer
364 views

Using Euler angles to rotate object 360 degrees

I'm trying to create script that rotates object in given axis by set amount of degrees. That's my 2 core methods ...
1
vote
1answer
193 views

Godot - Quaternion slerp is altering initial rotation of an object

I have a player that shoots a rocket. If the rocket has a target, I use a quaternion slerp to make it home in on that target. Free firing the rocket goes directly forwards as expected. Setting a ...
1
vote
1answer
17 views

Plane to always face object

How do i get a plane to always face an object with the flat/mesh/xy side? I tried sticking in Vector3. forward and up but i always get the plane facing the object on an edge. ...
0
votes
1answer
29 views

Move Object θ Degrees Over T Time

Note, this happens on click and not in the update cycle I have a game object that i rotate at a given angle, around a point without a time component like this(works as intended): ...
0
votes
2answers
80 views

How to rotate an object based on the movement and angles of Lifters

I have Lifters that "carry" an object. I want the object to move and rotate based on how those Lifters move. Requirements include: Supporting 1-4 Lifters at any side of the Object (e.g., ...
0
votes
3answers
158 views

How to calculate a direction that will turn a parent so that a locally-rotated child is faced in a given direction?

Imagine an old sailing ship with cannons: they're pointed out at 90° angles from the ship's hull, so in order to fire them, you have to turn the whole ship so that the cannons are pointed at the ...
2
votes
1answer
330 views

Clamp quaternion relative to plane normal

How would one be able to clamp a quaternion based on the angle relative to a plane surface (defined by a normal)? My diagram below provides more of a visual explanation of exactly what I am talking ...
2
votes
1answer
469 views

Euler angle and Quaternion conversion become weird when yaw is bigger than 90 degrees

I'm writing a camera which needs to change a quaternion to Euler angles than change them back, it only works when the yaw is less than 90 degrees, I wrote a example to check: ...
0
votes
2answers
46 views

Player is not looking at correct direction

My Enemy/Bot is facing the wrong direction as shown in the attached screenshot 1. Basically what I want is that Enemy/Bot gun should directly face the player, not enemy/Bot himself. Note: White line ...
1
vote
2answers
455 views

3D Camera Rotation (Unwanted Roll) - Space/Flight Cam

I am working on a camera class that will have full range of motion (pitch, yaw, and roll). When only altering pitch and yaw, I am getting a large amount of roll. I understand that the issue is ...
3
votes
1answer
415 views

Rotate quaternion around plane normal

How can one rotate a quaternion so that the rotation is around a plane normal? A graphic/diagram I made below gives more detail about what exactly I am implying. Note that the tip of the quaternions ...
0
votes
0answers
19 views

Quaternian coefficient multiplication

I have 2 quarternians (Q1 & Q2), I'd like to apply a coefficient to each Quaternian, where the sum of both coefficients = 1. As far as I'm aware, multiplying a quaternian by another is equivalent ...
0
votes
0answers
441 views

How do I determine the forward/right direction when I have the "up" vector? - Unity

I am trying to fix a gameobject for e.g. a cube (which i am using as a sensor) on my character. I need the cube to rotate (with orientation control from the inspector - I have a public quaternion ...
0
votes
1answer
103 views

Sensor quaternion to Unity conversion [duplicate]

I want to convert rotations given as quaternion from sensors to Unity. The sensors (documentation here) axis are the following ones: Unity is the following one: I don't know how to map axis other ...
0
votes
1answer
179 views

Handling rotation interpolation at 180 degrees

I currently have a scene where 3d a gents move throughout a grid, each time they move that can pick a random cardinal direction up,down,left or right. They then rotate to face that direction using <...
0
votes
1answer
368 views

How to replace Quaternion with Vector2 in Quaternion times Vector3 equation?

Edit: Having to edit this question extensively because DMGregory was right and there were unexpected consequences. I am working on local avoidance and pathfinding code for a 3D strategy game. It ...
0
votes
3answers
119 views

World rotation independent mouselook

Preface: I am terrible at using quaternions right. I wanted to create a world rotation independent mouselook script. That is, no matter the 'down' for the camera, the mouselook should feel natural to ...
1
vote
2answers
767 views

What is Unity Quaternion range?

I've read somewhere that a Quaternion in Unity ranges between [-1,1] values. I mean the individual XYZW values. Ex: new Quaternion(.1f,.2f,-.3f,-.4f) Is this true? More clearly: I know they take ...
2
votes
1answer
885 views

GLM conversion from euler angles to quaternion and back does not hold

I am trying to convert the orientation of an OpenVR controller that I have stored as a glm::vec3 of Euler angles into a ...
0
votes
1answer
90 views

Finding rotation quaternion from orthonormal basis?

Given three 3D unit vectors \$a\$, \$b\$, \$c\$ such that: \$a \times b = c\$ \$b \times c = a\$ \$c \times a = b\$ (ie \$a, b, c\$ form an orthonormal basis) How do we calculate a unit ...

1
2 3 4 5
7