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
128 views

### Rotating a cube with arrow keys

I have a list of rotations (on a cube in 3d space with the y-Axis pointing upwards, x-Axis pointing righthand and z-Axis pointing towards you) for example +90 deg around x-Axis followed by +90 deg ...
• 1
111 views

### Rotating player around planet causes drift in gun aiming at mouse

I have a bug with the rotation of a gun object that follows the mouse position. It has issues when the parent object player rotates. Example: The player has a gravity script to keep them aligned with ...
2k views

### Calculate angular velocity from rotation matrix difference

I am working on something for a game. I need to calculate the angular velocity, however in my situation I only have access to the previous rotation matrix and the current rotation matrix (and some ...
• 105
173 views

### What is the difference between the two circles in the rotation tool in Unity?

What is the difference between the two circles in the rotation tool in Unity? In 2D rotation tool there are two circles which allow to rotate an object. And I can not conceive a difference between ...
• 435
267 views

### track 2D offset after rotation

red is my origin point, blue is my offset, both are 2D vectors, how can calculate blue after rotation? this is the code I've been trying(just throwing things against a wall to see what sticks) ...
137 views

### Make transform.up face toward velocity while preventing transform.forward from rolling?

I have been working on a personal project that is suppose to mimic Anthem. I am using a state machine for the character controller that I intend to integrate with the Unity's Animation state machine. ...
48 views

### Rotation on one object affects all others

I am making a game using LWJGL. I have encountered a problem with rotation, looked it up, found a solution, and added it, but it doesn't entirely work. In the code below, the bottom section is ...
741 views

### Invert parent transform (doesn't work for combination of rotation and scale)

My problem I'm working with Qt3D and my problem is almost exactly like this one: https://stackoverflow.com/q/60995155/3405291 Suggested solution A solution is suggested here: https://stackoverflow.com/...
• 141
360 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 ...
• 29
56 views

### Leaning with Player Controller

I'm adding leaning to my player controller and I can't find out how to stop the rotation overriding the tilt ...
521 views

### How to calculate gravity vector based on device rotation?

I have basic scene where the cube sits on platform What I want is if the device is rotated 90 degrees to the left, cube should fall down as shown below I came up with a solution to tackle that by ...
1k views

### How to align cards in hand in a circular way?

I am working on a card game in Unity, and by now I instantiated my cards on a canvas. Now I would like to align them like I am holding them in real life. ...
1k views

### How to detect direction of rotation?

I have a character with a camera behind him. The head of the character rotates with the LookAt function on the character's head rig. The ...
476 views

### Rotate camera around offset to player position (third person shooter view)

I'm trying to rotate my camera 'next to' the player object so that the player is not in the way of the screen-centered reticle. What I am trying to achieve is something like the targetting system of ...
• 101
929 views

### Combining Rotation, Jump, and Crouch Animations with 2D Blend Tree

I have a 2D Freeform Blend Tree that I'm using to animate a character that can currently: Walk / Sprint Forward Walk / Sprint Backward Strafe / Sprint Strafe Left Strafe / Sprint Strafe Right Idle ...
7k 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 ...
• 141
78 views

### Rotate character

I want my player character (the feet ) to stick to the platform (like in the photo) rather than falling or following the physics. I want it to move like a spider but I am stuck. With the help of this ...
80 views

### Unity3D: Firing a projectile from orbit

I am dropping bombs from a spaceship orbiting a planet. My camera is affixed to the ship. I fire bombs by instantiating a bomb at the position of the camera, which is at all times facing toward the ...
• 135
196 views

### Turning the Turret towards Player Object

I  am trying to turn the enemy turret towards player object using the Armory 3D game engine with Blender. The script is written using Haxe. I am using the following code with both the player object ...
451 views

### Unity - Mathf.Lerp() didn't work as expected?

I want to rotate an object 360 degrees so this is what I did: xRotation = Mathf.Lerp(0, 360, Time.fixedDeltaTime * lerpTime) and then I used Quaternion.Lerp() to ...
6k views

### World position into local position

I want to understand how I can convert world position of an object into local position. Especially how to deal with a rotation of objects. I'm testing transform.InverseTransform(...) methods. When ...
• 29
1 vote
470 views

### UE4 - Event Tick and getting Forward Vector

I'm trying to make a game where my character rotates towards cursor (that works). He can choose between a few weapons (also works). One of the weapons works like a machine gun. My idea was to make a ...
• 426
789 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 ...
• 348
627 views

### Rotate relative to set point in a specified direction in a 3D space

I know there's a geometry formula to calculate the next point in rotation relative to another point in 2D but I'm working in 3D and I want to calculate the next position in specified direction as well....
1 vote
193 views

### Matrix transforming with translation/rotation/scale at center of screen

I'm trying to create a camera using matrix transforms, the gist is as follows: ...
• 23
473 views

### ScreenToWorldPoint: How much depth has to be added to screen point?

I am developing a 3rd Person Controller. The hero's chest should be rotated towards a point on the screen. To determine the point, I use the following code: ...
• 919
1 vote
209 views

### Rotation matrix to look at point p

Assume a left-handed coordinate system where x is right, y is up, and z is into the screen. You have a unit vector pointing up along the y-axis. What's the rotation matrix for pointing the unit vector ...
70 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 ...
• 123
766 views

### How to convert relative position of child to parent into an absolute position?

I am modifying a game that stores object positions with a 3d vector { x, y, z } and rotation as a 3d vector with degree angles ...
1 vote
569 views

### How to expand the limit of screen mouse access for FPS side rotation

I started coding in Godot and i have a working FPS controller but the problem is that when i move my mouse sideways , it cannot move my sight beyinid that side of my screen , in other words the ...
217 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 ...
• 337
1 vote
4k views

### Rotating towards a target in top-down 2D game

I use the following code to rotate a transform towards another. And it's working fine. However, I want to lerp it over time period. ...
317 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 ...
2k 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 ...
• 21
46 views

### How do I rotate shoulder bone up and down using Rotate and Space.World independend on model orientation

I wanted to move my character's arms up and down in a straight way. The Rotation Gizmo tool can do exactely that. Playing with the wheel of the Rotation Gizmo tool in the attached screenshot (marked ...
• 919
64 views

### How do I spread a LookAt rotation over 3 bones with different percentages?

I'm trying to rebuild the RE4 controller. At first, I thought that only the chest bone is used to rotate the pistol towards a target. I have then however found a hack to put the camera in a fixed ...
• 919
135 views

### Math: determining a proper procedural vector for sine-movement

My Problem Suppose you have an object moving along the x-axis, wobbling up and down. Movement code might look like this: x += 1; y = Sin(x); Move((x,y) * speed); ...
1k views

### Rotating camera in 3D without yawing diagonally

I'm programming a C raytracer. I'm having trouble getting the camera to rotate the way I intend. I would like the camera to rotate by pressing keys: F & H rotate left & right around the world'...
• 31
1k views

### Efficient way to build a 360 rotation system with clockwise and counterclockwise direction

I've been struggle with rotation for sometime now, maybe it isn't that hard for someone who dominates the mathematical side of things regarding rotation and angles but, I need to build a rotation ...
163 views

### How do I bring a child object in its original position after it is translated and rotated?

This is the original position of the cube and its child object cone. Over here, I have translated the cone for 2 units Now I have rotated the parent cube around 25 degrees wrt to the Y-axis If we ...
• 331
2k views

### How do I add an "offset" to LookAt?

I have created a Third Person Controller. The camera is behind the player: I would like to make it so that the player aims at the mouse pointer position. To do that, I use the following code to ...
• 919
1 vote
486 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 ...
• 115
1 vote
417 views

### PyBullet & OpenGL - Rotations are reversed in OpenGL [closed]

Project description: I am writing a basic game engine to help with my PhD topic on multi-agent learning. I am using PyBullet as the backend physics engine and OpenGL for visual display. I have OpenGL ...
1 vote
28 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. ...
• 151
33 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): ...
• 125
1 vote
130 views

### How to change the geometry of the scene in Unity?

I'm trying to experiment with 3D spherical geometry in Unity, but it seems like Unity objects are inherently set in flat space. My first idea was to create a class inheriting from ...
• 115
724 views

### Rotate Object in world space - Raytracing

I’m programming a C raytracing project. I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it. For each object I have its position (x, y, z) in the ...
• 31
1k views

### Changing ImageView position based on angle of rotation

I am trying to make an ImageView change its position based on the direction it is facing. ...
• 101