2022 Developer Survey is open! Take survey.

# Questions tagged [rotation]

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

1,075 questions
Filter by
Sorted by
Tagged with
30 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 ...
27 views

### Calculate the coordinates of an offset in 3D space knowing the initial rotation and final rotation of the object

Working on a game mod in FiveM in which I am representing bullet impacts with drawn lines in the game world along their flight path. I am getting a normalized vector and then calculating the offset ...
1 vote
26 views

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

I want to know the values of x, y, z satisfying the following. ...
• 121
21 views

### Need help Slerping position and rotation for a death cam

Issue I have 2 scripts on my camera, one for following the player ( FollowTarget.cs ), and one which is supposed to, over time, Slerp the camera's transform position and rotation around the player on ...
24 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 ...
• 103
1 vote
61 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. ...
38 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 ...
24 views

### How to use glLookAt() to rotate around an object orbit

I've been struggling with a school project in which I'm supposed to create a camera like the one in Blender. One of the steps I need to implement is to make the camera rotate around an object's orbit ...
1 vote
43 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. ...
26 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 ...
• 137
24 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
38 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
30 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
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 ...
• 103
23 views

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

I have this code that rotates my object: ...
53 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
28 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,101
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 ...
• 23
101 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 ...
• 479
15 views

### How to make golf putter rotate to ground normal's and still rotate with the handle

I am making a vr golf game and I am trying to get the putter to be level with the ground and still rotate with the putter handle. The two pictures below will demonstrate the problem. Then after I ...
1 vote
27 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 ...
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 ...
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 ...
69 views

### How would I calculate the standard 3X3 rotation matrices for unity? (for each axis)

So I've been working with the standard right handed ijk coordinates system where K (the z-axis) is up. If you want to rotate a vector in ijk you can use these rotation matrices to rotate the vector ...
29 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: ...
27 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
86 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
49 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
149 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
40 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 ...
50 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
16 views

### Finding final global orientation given starting orientation and local delta rotation

An object has a rotation (α, β, γ) in 3D space, using Euler extrinsic rotation (x–y–z). This object also has an additional rotation (Δα, Δβ, Δγ) in local coordinates. How can this information be ...
• 1
35 views

### How to rotate my enemy so it scans the area?

Hi I am new to unity so I am not super familiar with methods. I am trying to make my enemy rotate left then right double the amount that it rotated and back to the middle like this: +10 degree, -20 ...
78 views

### Why do objects spin in circles instead of stopping when reaching their target?

This script is attached to each drone. ...
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 ...
1 vote
64 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 ...
32 views

### How to make a sprite face the mouse while remaining upright, without negative scale?

In the game I'm creating I have a sprite that needs to constantly be facing the mouse, but the sprite also always needs to be facing "up". Because of the Polygon Collider 2D and Shadow ...
1 vote
195 views

### Pixelart loses quality when rotated in unity

Sorry, still fairly new to the game here but my pixel art gets little ridges on it when I rotate it in unity. I'd like the pixels to rotate all together. Is this just because I need to make my pixels &...
1 vote
47 views

### How to correctly rotate object using clamping and euler angles?

I've a player (a space-ship ;) that can rotate from -x to +x value (so clamped). So, before apply rtoation i check it: ...
• 817
47 views

### Can you interpolate statelessly?

I was just wondering if it's possible to to a linear interpolation between two rotations without maintaining any kind of state. What I mean is let's say I have a loop function where all my code is ...
• 65
74 views

### Local rotation towards world point, with axis other than forward vector

I have a turret transform which is a child of weapon game object. Which in itself is a child of player object. I want to rotate this turret towards a world point (Raycasthit.point of a ray going ...
1 vote
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 ...
• 23
1 vote
227 views

### Shooting from Gun in LibGDX

I'm trying to shoot a bullet from the tip of a gun. This gun is a Sprite object and it is constantly being rotated to point towards the mouse. The issue is that the point to shoot the bullet from is ...
62 views

### What math function represents Minecraft bow angle/height?

I am working on a mod in Minecraft Forge/MCP using Java. Aiming a bow is controlled by your head pitch and yaw rotation. Right now I have a math function that automatically looks at the target. But I ...
• 65
37 views

### Get Angle offset [duplicate]

I'm working on a game where the input is done via a joystick. Normally, one would snap the players rotation to the angle that the joystick is pointing, but for my game's purpose, I have to lerp to the ...
• 25
92 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 ...
116 views

### How to gradually interpolate smoothly between two yaw rotations in Minecraft MCP/Forge?

I am coding a custom client for Minecraft using MCP. (Please no hate, I'm not making a hacked client!) I have two variables currentYaw which is the current yaw ...
• 65
1 vote
78 views

### Limit rotation/direction of two axes with seperate values (Vector3)

Issue I'm trying to create a vector pointing in a direction towards a target, and then using that vector rotate a child transform to face the target while limiting the rotation on the X and Y axis, ...
1 vote
55 views

### Forward movement while rotating lead to flickering

I'm trying to make a ship move forward while also turning, but when I start to play, the ship flickers when it tries to move and turn at the same time. (as comments suggested, I added other code for ...
• 123