# Questions tagged [rotation]

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

1,184 questions
Filter by
Sorted by
Tagged with
15 views

### How can I map out multiple decals on a reel?

So I want to map out multiple Decals on this reel. How can I map it out aesthetically and mathematically correct ? Looking for a math god to help me with this calculation.
• 101
35 views

### Weird behaviors with transform.LookRotation when looking at position+Vector3

I'm working on a character controller for an isometric retro shooter. However, when making the character rotate towards where they are moving, I encountered some issues. The character doesn't fully ...
• 23
1 vote
38 views

### Quaternion.Euler acting weird

so I'm building up a simple arcade racing game and I was messing around with the Wheel Colliders setup. I was wondering if it was possible to add some camber adjustments in real time depending on the ...
80 views

### Comparison of 2 different quaternion axes

I am trying to compare the Z-axis and the X-axis of two different quaternions in a way that would give me the Euler angles about the X and Y axes to line up the two different axes. In my program, the ...
1 vote
21 views

### Pan orthographic non-axis-aligned camera

I'm trying to create a panning control for a camera in bevy, but I can't seem to get the panning logic right when the camera is rotated. It works fine if the camera transform is directly facing the XY ...
• 111
139 views

### Unity Navball x,y,z rotation axis' are not tracking main object

I am trying to figure out how to solve this issue. My navball is tracking the ship's rotation incorrectly as shown in the image. When the ship rolls (Z Axis) to the right, the navball rotates down on ...
• 103
1 vote
52 views

### How to calculate a direction vector from a 3x3 rotation matrix?

I have a dataset containing 2D images of telco towers and metadata. Each 2D image has 3x3 rotation matrix which provides orientation info about the drone when it captured the image. Now I have a 3D ...
48 views

### Camera rotation in TouchDesigner

I need help on something I'm struggling with very much. I am working on a TouchDesigner patch where I have a Camera COMP with rotation on x, y and z axes. I need the formulas to convert such rotations ...
1 vote
130 views

### In Godot, how do I reposition the center of my mesh?

When importing a Unity package to Godot via Unidot importer, I noticed that a few imported models have their child rotations and transformations off-center from their expected points. For example, ...
164 views

### invert:condition "det==0" is true error with no obvious cause

For my project I am turning my CharacterBody3D 90 degrees on the x-axis towards a wall. To achieve this I set basis.Z to the <...
• 23
34 views

### How do you rotate a BoneAttachment3D during an animation?

I have a case where I want to rotate a bone that is otherwise controlled by an animation. The bone is the head bone of a humanoid skeleton. I have attached a ...
• 141
159 views

### Why are Quaternions better than Euler-Angles for Godot (when to use which)?

Sorry about the click-bait, I know there are many many reasons why Quaternions and Bases are better than using Euler-Angles. Anyone on a 5 second google search could easily know why! But I am trying ...
75 views

### Turret following the player in the opposite side

i have tried using lookout method then flipping it by 180 degress but it gives me the same result as the problem i had before. my turret turns left when i move right and vica verse. To fix this i used ...
• 23
70 views

### How to rotate spaceship quaternion to face target direction with constant angular speed?

I have an enemy spaceship, and I want to make it turn to face the player with (for now) a constant angular speed. The ship's orientation is a quaternion. How do I do this? Since this is totally free ...
• 111
61 views

### Motion Retargeting from a BVH File to a Rigged Mesh in Unity with Arbitrary Rest Pose

I want to perform motion retargeting from a .bvh file (from lafan2 dataset) to a rigged mesh in Unity (which is John Lemon in this tutorial resource). I have overcome most of the problems, but this ...
51 views

### How to get difference in rotation between 2 objects, but only on one axis

Say I have 2 cubes that start with the same rotation. I wish to track the rotation difference between the 2 about the z (forward) axis. Such that if cube A remains stationary and cube B rotates 30 ...
36 views

### Usage of 'World rotation quaternion'?

While debugging the code that decomposes the world matrix, I found that the decomposed world rotation value is different from the world rotation value stored in Transform. Simply, World Rotation is ...
92 views

### Calculate Up Vector of Object on Surface Given Points and Normals

Context I want to find the up vector an object would have if it were leaning on a surface, given a large amount of points on that surface and their associated surface normals (i.e., an equation that ...
• 21
1 vote
39 views

### 3D transform hierarchy rotation applied in wrong order

I'm following in the footsteps of this blog in implementing a transform hierarchy to my game engine scenes. I have a fairly similar implementation for a 3D transform: ...
• 11
45 views

### Unity Camera snaps back to camera mouse look after lerping to a point and rotating normally. Once mouse look is re-enabled it overrides and snaps back

I am trying to get the camera to rotate towards a location and position. Which works at the moment, but once it is done and re enables the mouse look script or bool in the script the mouse look ...
42 views

### Rotation inside MeshInstance3D surface plane

I'm trying to make a representation of a plane that rotates around a hole in a MeshInstance3D. So far I've managed to make the circle's hole, but I can't make the ...
52 views

### How to align to 2D ground surface directly underneath?

I'm out of ideas at this point. I'm trying to set up a function inside my player controller that aligns the player with whatever is under it (usually the ground), ive tried using Raycasts, collisions ...
• 404
1 vote
172 views

### Calculate path segments size

I have a problem more closely described on a picture below. The idea is that I have my agent in point A and I want to get to the point B. The problem is, that agents rotation towards point B is alpha ...
• 13
34 views

### Sawblade's spin stops or jitters when swiping to steer it

I have a 3D object, a blade, that I want to rotate continuously on the x axis, like it's cutting through something. I also want the player to control its z-axis rotation by swiping. It's mainly ...
62 views

### Is this gimbal lock I'm hitting even with rotation matrices / quaternions?

I'm spawning a trigger box relative to another object using local offset. The engine I'm using does not provide a native function to make that conversion (at least in a way accessible to me), so I am ...
• 176
45 views

### Why do my trigger zones change rotation randomly on gameStart in editor?

I'm now doing a racer on rails like "Outrun". I do have a cool Script from internet that makes the camera and the player follow the Waypoints. The Waypoints are Trigger shapes. I have a ...
33 views

### Raycaster rotation problem

I am following lodevs tutorial on Raycasting https://lodev.org/cgtutor/raycasting.html. I was kinda successfull but for some reason while implementing a 2D Topdown view of the map and the player i ...
• 1
52 views

### Unity clamping local rotation on LookAt issues

I'm new to game development, and I've been trying to code a "smooth camera" rotation that's limited within the camera's local rotation, using a smoothed cube and ...
73 views

### Weapon flips upside down when aiming to the left

When the player turns to the left, the texture of the weapon turns upside down. How can I solve this? Shooting Script ...
1 vote
105 views

### How to set pivot point for rotating a sprite?

Is there a way to set the pivot point for rotating a sprite? The default option seems to be arbitrarily chosen point on the sprite or the mid point. ...
• 111
45 views

### Problem when changing matrix view in screen space reflexion

I’m using (DX11) LookAtLH or LookTo functions to get my view matrix. When setting Camera Direction so that the y component is zero I have the correct reflexion (picture left). When changing the Dir.y ...
• 139
69 views

### Aligning vector by rotation around non-orthogonal axis

This is almost more a geometry/mathematics question than a game dev one, but I think I'll have a better chance actually understanding the answer if I ask here. Rather than try to explain it- because ...
• 163
253 views

### Rotate Object Smoothly When Dragging

I want to make a 3d object rotate smoothly when being dragged in a ui in Unity. My stuff currently works but I just can’t get it to rotate smoothly, I can only make it rotate instantly which looks bad....
36 views

### Rotate UVs in shader and contains result into quad with repeat edge pixels

I ask for help - I need to rotate the UV scan inside the quad by a certain angle (set by a parameter) so that the result is embedded in the original UV, and the missing areas are repeat edge pixels. ...
30 views

### Follow camera is not turning when the followed object turns

I need a camera follow script to chase a moving ball. I've attached the script below to my camera, but when the ball turns left and right the camera does not turn ...
1 vote
126 views

### How to set world rotation directly in Stride?

I just started looking into Stride as a replacement for Unity, and I'm trying to rewrite some scripts. My question is: How do you set the world rotation of a transform component? In other words, what ...
• 13
1k views

### How to rotate NavMeshAgent toward its movement direction?

I'm working on a 2D game in XY plane. I've created enemies using NavMeshAgent and I've gave my agents way pints to move between them. The problem is that I don't know how to rotate them in the ...
126 views

### Correct order on accumulating rotations

Suppose I have an Arcball camera that rotates up/down and sideways based on mouse input. After doing some research, I discovered that the correct way of calculating the new orientation is to do it the ...
150 views

### Finding loss of angle and length due to rotation

I'm working on a targeting system for my 2d game. But I want to see the object in isometric perspective. My calculation is correct for 2d objects but it doesn't work for rotated in x axis objects. I ...
58 views

### Quarternion rotation flattening cube

I am trying to rotate a cube using a quaternion matrix with WGPU. However, whenever I try to rotate it, I end up with I am using the matrix from https://en.wikipedia.org/wiki/...
299 views

### How to make enemy turn to face the player while attacking?

I need help making this code work. It is made for the enemy AI to move and patrol, chase the player and attack the player. The problem is when it starts to attack the player, then the player can move ...
26 views

### Rotate the parent object so that the child object points to the cursor 2D [duplicate]

I have an arm that has a pivot point on it. I want to rotate the arm so that the barrel of the gun points to the cursor. How do I calculate the angle of rotation for the arm? I'm not very good at math ...
80 views

### How to keep an object that rotates around another at the same height when the radius changes?

In my game, I have one object that rotates around another using transform.RotateAround, and I need to change the radius of its orbit. The behavior now is that the ...
• 1,757
1 vote
356 views

### Using both look_at and flip_h in Godot

I am trying to have a player running in a side scroller platformer with its arms independent from its body, so that the arms can follow the mouse (to aim). The issue is that when the character goes to ...
• 113
144 views

### Where is the illusion of a moving camera perspective coming from in this rotatable cube model?

Just for fun, I had been attempting to build a model cube in vanilla JS that can be moved and/or rotated. What I was going for was the simplest possible representation (so, no adjusting for ...
61 views

### Rotating around 3D cube Camera Controller for Unity

I am Unity game developer with more than 2 years experience. I am working in a personal project, a mobile game for Android in Unity. I am trying to make a camera controller for a 3D Cube Game in Unity....
114 views

### Inertia Tensor Relative to Center of Mass vs Inertia Tensor in Body Coordinates

If I have the inertia tensor relative to the center of mass, is that the same as the inertia tensor in body coordinates? If no, can you please explain the difference and how do I numerically calculate ...
97 views

### Smartphone tilt calculation when using gyroscope in Unity (smartphone moving problem)

I have been trying for several days now to set up the correct behavior of the gyroscope in Unity. I want to make it so that when the smartphone is tilted, the object tilts along the z-axis. I found ...
129 views

### When to use InverseTransformDirection in Unity

I want to know when to use InverseTransformDirection. Unity documentation says : "Transforms a direction from world space to local space". Honestly, it is not clear for me. I came across ...
• 169
1 vote