# Tag Info

Accepted

### I'm rotating an object on two axes, so why does it keep twisting around the third axis?

No this isn't an engine bug or an artifact of a particular rotation representation (those can happen too, but this effect applies to every system that represents rotations, quaternions included). You'...
• 135k
Accepted

### How can I rotate an object based on another's offset to it?

The answer is actually pretty easy if you do the math. You have a fixed distance of Y and a variable distance of X (See Picture 1). You need to find out the angle between Z and X and turn your turret ...
• 3,126
Accepted

### How to make sure spinning objects hit a target with the right end?

Fake it Look at the video you linked, watch it in slow motion... eh, what is that? The camera jumps at the end, and the knife is already in the helmet of the target. Just fake it. Once the distance ...
• 27.2k
Accepted

### Using Quaternions: What can I do with them? (without the maths)

Multiplication At least in terms of Unity's implementation of Quaternions, the multiplication order described in the question is not correct. This is important because 3D rotation is not commutative. ...
• 135k

### How can I rotate pixel art sprites without the aesthetics getting ruined?

Have a look at RotSprite. RotSprite is a scaling and rotation algorithm for sprites developed by Xenowhirl. It produces far fewer artifacts than nearest-neighbor rotation algorithms, and like EPX, it ...
• 453
Accepted

### How can I rotate pixel art sprites without the aesthetics getting ruined?

Automatic rotation of pixel art by other angles than 90° usually goes wrong. If you want to maintain the pixel-art aesthetics you usually won't get around redrawing your art in each angle. If you use ...
• 120k

### Using Quaternions: What can I do with them? (without the maths)

Where's the dot product used? In Unity, one of the most common users of the dot product is whenever you check if two quaternions are equal via == or ...
• 611

### How to make sure spinning objects hit a target with the right end?

If you know ahead of time where the knife will land - like in those kill cam footage, which is most definitely produced after-the-fact - just calculate the right rotation speed based on flight ...
• 14.8k

### How to make sure spinning objects hit a target with the right end?

Calculate the straight line distance to target. Each Frame set the angle of the knife to be 2PI*(remainingStraightLineDistance)/(originalStraightLineDistance)*DesiredNumRotations. The spin ratio will ...
• 556
Accepted

### Unity: transform.LookAt(target) not "looking at" target?

The Problem: Your eyes default rotation makes them look to the negative X axis. However, Transform.LookAt() rotates the transform, so that the Transform.forward looks at the target. The Transform....
• 407
Accepted

### Rotate from Current Rotation to Another using Angular Velocity

"maybe due to the gimbal nature of Vector3 for angular velocity" ...using Vector3 for angular velocity does not entail gimbals, but converting it to Euler angles does. Angular velocity is not an ...
• 135k
Accepted

### Converting a quaternion in a right to left handed coordinate system

A quaternion can be thought of as an angle-axis representation: quaternion.xyz = sin(angle/2) * axis.xyz quaternion.w = cos(angle/2) So, converting them between ...
• 135k

### In LibGDX, how might I make an object orbit around a position?

If you wish for an object to orbit around a specified point in two dimensional space, you want to use some trigonometric functions. Here is an example method to calculate an objects position in an ...
Accepted

Basic explaination about the method with regards to positioning, scaling and rotating: This draws a sprite with myTexture with the topleft corner on 100,200: <...
• 4,067
Accepted

### Direction vector to quaternion

From http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/ ...
• 3,719
Accepted

### Rotate an object to face a point with glm::lookAt

Because the lookAt function is to position the camera to look at an object (not for an object to look at another object) and the way 3D cameras work is that ...
Accepted

### Unity - moving an object around a radius

You need to put a cap on how big rotationAngle is allowed to be. Right now, as the difference between the mouse and the "player" grows larger, your "player" ...

### Why are rotations in 2D game engines often counter-clockwise = positive systems?

Why have we arrived at the convention that rotations should be counter-clockwise then, even in engines where positive y is down? Have we? Let us try CSS: ...
• 27.2k

### Combining Quaternion Rotations

Multiplying two quaternions gives you a quaternion equivalent to performing the two rotations they represent in sequence. ...
• 135k
Accepted

### Extract a rotation matrix given a camera direction (vector) and a up vector for the camera?

NOTE: Edited because it was likely too verbose (source). A rotation matrix actually always defines an orthonormal basis. What this means is each column defines one of your original axes in its ...
• 166
Accepted

### How to make one 3D object face another?

There are a couple ways to do this, but here's one way to do it. We can generate a rotation matrix by storing 3 normalized vectors as columns for a 3x3 matrix. The first column will be normalized ...
• 1,319

### Convert quaternion to a different coordinate system

Summarizing your two coordinate spaces: ...
• 135k

### Unity Quaternion.LookRotation meaning

Quaternion.LookRotation(forward, up) constructs an orientation quaternion that... rotates an object's local z+ axis (0, 0, 1) — the blue arrow on its local ...
• 135k
Accepted

### Why use gimbals?

If I understand you correctly, by local rotation you mean something like this: ...
• 135k
Accepted

### Is there any way to keep the applied torques in the old planes, even if the ship's local plane has rotated?

First, your interpretation of what's happening in Unity is not accurate. When you apply your roll torque, the axis of the continuing yaw drift does not shift to match the object's new local XZ plane, ...
• 135k

### Why rotating an object only on its local X axis result in sudden 180 degrees changes in Y and Z axis rotation values

The thing to remember about Euler angles is that they're a fiction the engine generates on demand for our sake. They're not the ground truth of how rotation is stored inside the engine (that uses ...
• 135k
Accepted

### Handedness of 2D coordinate systems

It entirely depends on what you want to do with it and both have reasons why they exist. The one where the top left corner is the origin and the positive xes point away from them are based on the way ...
• 14.9k
Accepted

### Unity3d: Find which gameObject is in front

You can check simple ahead/behind relationships using the dot product: ...
• 135k