The 2024 Developer Survey results are live! See the results

# Questions tagged [rotation]

Rotation is the circular movement of an object around a specific axis.

1,190 questions
Filter by
Sorted by
Tagged with
69 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 ...
• 58
258 views

### How to show orientation on an image minimap in Unity

Initial Question: I'm trying to create a minimap for my game in Unity. It consists of a 2D image sprite within a mask. I've got the rotation and the movement within the mask down, but the only problem ...
237 views

### Calculate angle for arrow tip to hit a point

For an archer in my game, I want to calculate the launch angle to hit a point (x,y) when fired from (0,0). The initial power is known, so I use the following formula: https://en.wikipedia.org/wiki/...
• 13
164 views

### Rotate game object to the mouse pointer

I am making a game from scratch using OpenGl and GLFW. Since my motivation is to learn computer graphics, I am using my own explicit math functions for rotation and translation. My current rotation ...
2k 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 ...
• 43
1k 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 ...
• 157
211 views

### Clamping angle between two ranges

I try to "limit" the amount of angular movement my character is able to "show". I'm using Unity. I have 3 components in my player entity as below: The "Player" contains ...
• 111
2k views

### How to lerp correctly between two unlimited rotations

Hi i have a start point and end point which i use to create some point between, this points are calculated with a blending rotation between point A rotation to point B rotation. I use Mathf.LerpAngel ...
• 41
119 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....
• 10.2k
202 views

### Alter vehicle angle to match that of ground

I am trying to align a non physics vehicle to the same angle as the floor, using blueprints in UE4.27 At first, I used normals, but this has undesired effects when going over things like speed bumps. ...
242 views

### How to rotate parent object to align child rotation with a separate game object?

I have attached two images with the desired start and end positions. The Brown Circle is the target rotation. The Orange Square is the parent (the black dot is the pivot point) and the Blue Rounded ...
1k 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 ...
51 views

### Changing Coordinate Origin [From Coord System A -> Coord System B]

I'd really appreciate some help on this one. Given 2 coordinate systems A and B where xA is an initial Vector3 position, rA is an initial Quaternion rotation xB is an initial Vector3 position, rB is ...
72 views

### Rotating Cube by 90 degrees causes

I'm making a game where I'd like the player to be able to rotate a cube by 90 degrees on the x or z axis by pressing a button. I've gotten fairly far along in the process, but I've run into two ...
439 views

### In Unity, why does a positive Z-axis rotation goes counter-clockwise while X and Y rotations go clockwise?

In Unity: With a perspective having Y and Z axes pointing up and right respectively, if I make a positive X rotation, the object rotates clockwise With a perspective having Z and X axes pointing up ...
• 101
187 views

### Player rotation using relative mouse movement instead of absolute

I'm working on a twin stick shooter where the player looks at the mouse cursor. Like most I use the absolute mouse position and the player's position to determine the direction and derive an angle. ...
• 1
146 views

### Rotating dials with increments, one works and the others doesn't. Why?

I have 4 dials that rotate by increments when the players drag them. They all exactly have the same code, but I can't figure out why only one of the dial works as intended (dial 2). My code stops ...
604 views

### How can I rotate my BoxCollider2D 360 degrees around other colliders while maintaining a constant forward direction?

I'm trying to get my 2D character to rotate around colliders based on the current ground normal (sort of like in Mario Galaxy) detected by Physics2D.CircleCast, ...
85 views

...
• 1,757
1 vote
159 views

### How to make an object move and rotate the same amount as another obejct

INTRO: I am trying to make a camera move around in a fast moving, rotating in all axis, spaceship.... This person has achieved exactly what I need to achieve if that is a good reference for you (go to ...
• 289
59 views

### A point on a sphere surface needs to be converted to origin coordinate

I have a central point, a planet is moving around it on the orbit A (a circle) And the planet is rotating at a certain speed on its axis ( B ) I have a Data Structure representing the Base Mesh ...
• 105
1 vote
1k views

### Rotate an object relative to the player to face another object

Essentially, in my game, I have 3 objects: a player, a shield and a puck. I want to have the shield orbit the player to automatically face the puck. (So the position will change with the rotation). <...
543 views

### how to have player stay on a rotating platform?

Im making a top down game in unity. in my game there is a platform where the player can stand on. while this platform is moving the player moves with it. here is an example: This almost works like i ...
1 vote
983 views

### How to convert ZXY euler rotation to XYZ?

I want to know the values of x, y, z satisfying the following. ...
• 121
501 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 ...
• 105
1 vote
144 views

### Making interacting gears in 2D

I want to create mutually rotating gears for a puzzle game. I looked at a lot of material, but didn't understand how to make a RigidBody2D stay in one place correctly and interact with each other. ...
732 views

### Calculate the angle of rotation between two vectors relative to the first vector

I'm trying to get the angle between two 2D vectors relative to the first vector input. Every method I've tried has given me a value between 0-180 degrees but doesn't tell me whether it was a clockwise ...
1 vote
970 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. ...
73 views

### Changing Model's rotation to keep its left side toward the pivot as it goes in a circle

I wrote a little script for my scene that allows my ship to circle an island, and it seems to work alright. Now I am trying to get the ship model to stay broadside to a pivot point in the center of ...
• 143
39 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: ...
• 103
1 vote
85 views

### Rotating an Icon On MiniMap

I'm creating a minimap for my game. There is a mission where the player has to escort an NPC to an area. The minimap shows the player, the NPC and the location. The NPC icon sends an arrow from it's ...
• 31
692 views

### How to decompose a GLSL mat4 to original RTS values within vertex shader?

I need to get the rotation differences between the model and the camera. convert the values to radians/degrees and pass it to the fragment shader. for that I need to decompose and the Model rotation ...
• 101
78 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 ...
• 103
85 views

### Change speed of rotation (magnitude) without changing direction (sign)

I have this code that rotates my object: ...
1k views

### How to change LookRotation so the y axis will always face the target position

I have this script that points a missile's z+ axis at its target: ...
• 253
425 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 ...
• 1,213
284 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 ...
• 103
1k views

### How to rotate parent and all children by center pivot?

I have a DoorSprite with an Animator component which I animate by rotating it by 90 degrees (makes the door look like opening ...
• 581
1 vote
102 views

### Calculate 2d rotation to target (uniformly accelerated rotation, constant speed)

I'm trying to calculate an uniformly accelerated rotation for the autopilot module in my 3d space game shooter. The autopilot should fly the spaceship to any given point in the 3d space on the ...
79 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 ...
1k 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 ...
49 views

### Setting joint angle from a slider makes joint spin continuously [closed]

I use sliders to change the rotation angle of my joint, like this: ...
• 238
142 views

### Finding controller's rotation about arbitrary axis

I'm trying to simulate knobs in a virtual reality environment where the user can grab a knob and twist it with the controller. Essentially what I'm trying to do is translate the global rotation of the ...
• 1
450 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 ...
• 119
417 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 ...
• 13
640 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), ...
• 123
125 views

### Each time a new platform spawns, rotate it 90 degrees from the previous

All I want is when the platform changes its position on the x or the z axis, then rotate the whole platform by 90 degrees. When I try to do this with the following code, I don't see any change - the ...
128 views

### How to compute the origin/pivot point of objects in a hierarchy

I'm sorry if the title is bad, but i'll try my best to explain my problem. Consider a simple hierarchy of objects (Object1 -> Object2 -> Object3) If i now were to rotate Object1 by 45 degrees in ...
• 119