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
1 vote
404 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
147 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 ...
63 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....
136 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 ...
105 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 ...
153 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
40 views

How to throw an object using a rotating arm controlled by the player?

Apologies in advance for my lack of knowledge, I am very new to 3D My goal is relatively simple. The player controls an arm and uses the mouse to rotate it around a point. They can hold the mouse ...
• 11
120 views

Choose rotation facing direction

I am rotating a gameobject in Unity so it always faces another gameobject. However I want to be able to decide which side is going to face the target. I want to be able to change the facing point to ...
150 views

How to rotate a plane about its origin?

I am trying to figure out how to rotate a plane about its origin in 3D space. Here is the last iteration of the code I am working with; the plane does not move. ...
280 views

Why can't I edit the rotation property in prefab mode so that rotation changes apply to all instances?

I am learning using the Explore Unity Course. In the picture you can see I've instantiated many hats from the same prefab. I want to rotate the hat in prefab mode so that the change will apply to all ...
28 views

How to make Cardial Directions relative to the camera

Lets suppose tha my movement method my W goes towards north(just figuretvly) and my E goes towards east, If I rotate my camera to east I want my W to insted goes to north, goes towards east and my E ...
46 views

Orient a player mid-air to their predicted landing orientation in Unity?

Ever played Skate 3? When dropping into a ramp, or if you're midair, your player's up direction aligns to the normal of the surface you're about to land on, while respecting the player's forward ...
164 views

3D First person Rotate Character Unity

I'm facing the problem that my chacter is spinning around itself when I try to move, that's because Im trying to make my player move in the direction of the camera, but when I move it keeps rotating ...
127 views

How do I make my player rotate in the current direction of my camera in Unity using C#?

I have a player with third and first person camera, I want to make my player move in the direction that my camera is looking at when I hold the right mouse in third person and move(Like my player is ...
1 vote
179 views

How do you rotate an object that uses a quaternion to represent orientation in 3D from a 3 vector input with values from a gamepad?

I'm using unity3d to create a six-degree of freedom flying game. The game takes in input from a standard dual-stick gamepad (like the Logitech f310). In unity each of the gamepad's joystick's axes are ...
• 37
1 vote
658 views

Orbit and control distance from object in 3D

I'm stumped on a key part of my game project, built in Godot 3.5.2. I'm trying to have my player character be able to rotate around an object using A and D, as well as get closer and farther from it ...
• 13
190 views

Rotating on Z axis with easing

I am stuck with rotating a GameObject on the Z axis with easing. I want to achieve an effect like in this game: Here, the ring of targets starts rotating periodically. It starts slower, than ...
• 105
159 views

how to rotate my character along the y axis when character is aligned with a slope

I have a capulse character Im moving around in my 3d Game, I usually rotate the character using this line of code: ...
• 11
1k views

How to clamp rotation on a specific axis?

I want to rotate an object based on mouse delta but I am unable to clamp it because I only want it to turn so far on a specific axis. ...
2k views

How to rotate a mesh in shader graph?

I want to rotate a mesh in a way that the Z axis arrow always points towards the camera. For a script I would do something like this: ...
194 views

How to rotate a player to orient their up with a landing normal?

I'm making a skateboarding prototype in Unity, and like in skate 3, I'd like the player to sort of "align" gradually to their predicted landing slope. I've written the code that gets the ...
202 views

Trying to rotate a 2D kinematic object along its Z axis when its Y rotation is exactly 180 degrees causes massive rotation swings

I have some code that allows an object to be rotated back and forth on its Z axis, but am having issues when the object has an initial Y rotation of exactly 180 degrees while also trying to rotate it ...
159 views

glm::eulerAngles gives unexpected output for quaternion

I used the euler->mat4->quat to give the right result, but euler->quat gives the wrong result - is there something I did wrong? ...
1 vote
482 views

How to rotate 2D image in 3D space using a quaternion

I am trying to rotate a flat 2D image around a 2D origin in 3D space. The problem I am having is that the image becomes stretched after the rotation. I am using the WGSL from this tutorial, but with ...
436 views

Two methods of finding angle between vectors give different answers!

Ok, am I misunderstanding how Unity quaternions work, or is there a bad (about 2 degrees difference!) floating point error? The TLDR is I use a quaternion r to rotate vector v and put the result in w. ...
80 views

Rotation is happening in reverse when the cube is upside down

I am writing this functionality in DirectX to rotate cube using the mouse. Now the functionality is working perfectly fine when the cube is sitting straight, but mouse functionality is reversed when ...
74 views

Align two meshes given 2 faces

I have two meshes (A and B) and I know that a triangle in A has the same size and same angles as a triangle in B. For simplicity, suppose A is an octahedron and B is a tetrahedron. And suppose the ...
• 961
1 vote
24 views

I have a wind simulation in Unity, and i need to rotate an arrow to show the wind direction [duplicate]

I have this code that creates random vectors, which are used in the AddForce to push rigid bodies around. ...
• 31
34 views

How to find position and rotation intervals for spawning objects in allowable alignments?

I'm trying to find intervals of positions and rotations to spawn the cup in front of the hand so that it is graspable (The cup is child of the hand). The problem is that I'm moving the mug in the ...
• 101
46 views

How do I align segments of rope to connect adjacent segments?

I have made a 2D rope in Godot using this thread here. The problem I am facing now is that the rope is not rotating towards player. I have tried look_At but it only ...
• 33
239 views

Finding the center of rotation in 3d knowing the start/end transformations

I need your help to solve a trigonometry problem, I'm unable to find any documentation about on the web... For convenience, I will use "transform" to indicate a position+orientation. Let's ...
1 vote
693 views

How do I move an object along its local axis?

I am new to computer graphics and am trying to make a simple little game where I can move a cube around with the keyboard. I have it so you can rotate the cube with the arrow keys, and I wanted to ...
• 13
1 vote
1k views

Find look at rotation with offset

I've been trying to make a function similar to "Find look at rotation" but with an offset. Imagine I have a pivot and an object attached to that pivot with some location and rotation offset. ...
254 views

Rigid Body is rolling/spinning on collision, is there a way to have it slide on surfaces instead?

I have a rigid body with a sphere as a collision mesh which can move and rotate freely. It realistically spins when colliding with other objects, but this is annoying from a gameplay standpoint. Is ...
193 views

6DoF camera control with a toggleable gimbal/horizon line lock and auto-upright button

I have a smooth 6DoF controller from following a tutorial (this is the tutorial) and tweaked it to be exactly what I want with a few exceptions. I found myself wanting the ability to lock the horizon ...
74 views

FPS controller capsule snaps back to zero when rotating

I'm trying to make a simple FPS controller, but when I try to rotate my Player Capsule it just snaps back to zero ...
57 views

Different approaches to rigid-body movement

I'm a beginner at game development and I'm building my own physics game engine to grasp the concepts. I wonder if there are different approaches to moving and rotating a rigid body. For example, ...
• 1
1 vote
337 views

How do I use Transform.RotateAround to gradually rotate my GameObject around a new pivot in the shortest direction?

Given a normalized Vector2 or eulerAngles.z, I'm trying to gradually rotate a 2D box around a new pivot (the top of the box) ...
101 views

When I rotate a game object, it keeps moving the same direction

When I try to rotate my game object, it keeps moving in same direction. I think there is pretty basic solution but couldn't figure it out. Here is my code: ...
• 349
205 views

2D turret aiming at the player, but only within a certain arc and with a defined angular velocity

I have a turret game object and a player game object, say it's a spaceship. Right now, every frame the turret updates its rotation, so it's always pointing at the player, giving it potentially ...
1 vote
1k views

How do I increment a quaternion rotation in update()?

When working with rotations expressed as angles, it makes sense to be able do to something like void GameLoop::update(){ pawn.rotation.x += 0.01; } And slowly ...
• 359
1 vote
85 views

How can I update my kinematic object's rotation based on how much it has moved per frame?

I'm moving a kinematic circle (and its child sprite) horizontally back and forth after a delay using transform.Translate(). I'm wondering how I can find a suitable ...
1k views

Implementation of Vector3.RotateTowards from Unity

I'm using vector3 as direction of object movement and i want to smoothly rotate it to another direction vector. I found SLERP but it rotate by percent. Looks like Vector3.RotateTowards is what i need, ...
880 views

Stop an object from rotating past a certain rotation value in Unity

Learning how to program in Unity, so bare with me. I'm making a game called Flappy Bird and I'm having issues with my z-rotation boundaries. Let's say I have some gameObject (call it Bird) that goes ...
• 121
211 views

Rotate FPS Controller without Mouse

I'm trying to set up a game with portals in it. I've been struggling for a while now to rotate the Player. I've tried Quat.Slerp, Quat.AngleAxis, and Quat.Euler. But through rigorous testing I ...
788 views

How to rotate a child game object everytime when parent rotates? [closed]

I have a GameObject called Gun, and a GameObject called Hand which is a child of other GameObject named Player. When I pick up the gun, it becomes a child of the hand. The problem is, when the player ...
• 35
93 views

When device is put in landscape mode, a cube in the corner of the screen no longer appears to face forward

I've made a cube in the corner of my screen always face forward: transform.rotation = Quaternion.LookRotation(Vector3.forward); If I hold my iPad upright, in ...
196 views

How to rotate door on y-axis, triggered by the player

I am trying to create the door that is triggered by the player in an FPS game. I can't figure out how to make the door rotate only on y-axis. I want the door to be triggered by the player, but still ...