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 ...
6
votes
4answers
10k views

Applying angular velocity to quaternion

I am reading Game Physics Engine Development by Ian Millington currently. In his book, he represent an orientation of rigid body by quaternion. I don't understand the formula where he apply angular ...
0
votes
1answer
104 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
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 ...
4
votes
1answer
2k 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
2answers
546 views

Unity3D - Camera Jitters When Displacing and Rotating Smoothly

DISCLAIMER: I am using Unity 5.6.5f1 for this code, I honestly don't know if there would be API updates on later versions, though I don't think so. I tried to make a simple Third Person Camera that ...
0
votes
1answer
345 views

How do I calculate the new Quaternions from translated points?

The code below is for a rag-doll using Verlet method, I have the correct points (or joints) positions, I just need the correct Quaternions, otherwise the resulting model looks like in the picture, I'm ...
1
vote
3answers
127 views

How do I rotate a sphere so that a position on it comes to a specific location?

Sorry for my english. I added a picture to explain what i want. I want rotate Big Sphere to make the black point locate in front of camera. (to the white point's position) not black point moving, ...
0
votes
3answers
259 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 ...
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 ...
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 ...
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
2answers
158 views
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
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 ...
30
votes
6answers
49k views

Rotating vector3 by a quaternion

I am attempting to rotate a vector3 by a given quaternion. I know that this is true $$ v' = q \cdot v \cdot q^{-1} $$ I know that \$ q^{-1} \$ is the inverse which just \$ \frac {-q} {magnitude(q)} ...
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 ...
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
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 ...
0
votes
1answer
609 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 ...
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
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 ...
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 ...
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
159 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 ...

1
2 3 4 5
7