Linked Questions

61 votes
2 answers
27k views

I'm rotating an object on two axes, so why does it keep twisting around the third axis?

I see questions come up quite often that have this underlying issue, but they're all caught up in the particulars of a given feature or tool. Here's an attempt to create a canonical answer we can ...
  • 121k
0 votes
1 answer
2k views

How to rotate CharacterController on slope

I'm trying to rotate my characterController player on a slope on the 'x' and 'z' axises, however things aren't going so well. The player does rotate, but if I move and look in another direction, the ...
user avatar
0 votes
1 answer
2k views

Unity smooth local rotation around one Axis, oriented toward a target

I want to acheive the same rotation you see in the inspector. In short: a smooth local Y rotation, toward a target I have a Vector3 orientation: ...
  • 281
0 votes
1 answer
637 views

How to set transform.up without locking the y-axis?

I'm trying to make an object's transform.up to a normal of the raycastHit point. I tried using this line of code: ...
  • 115
0 votes
2 answers
246 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 ...
0 votes
1 answer
218 views

Character rotation jitters when looking around

I want my character to walk around sphere like a planet, so in my script I rotate it according to the normal of a raycast and I also rotate my character on the Y axis when I look around with the mouse....
1 vote
1 answer
203 views

Why does my 2D top-down joystick code occasionally stop working?

I'm working on a 2D top-down game, and am working on the player controls. I have the following code currently controlling a player sprite: ...
0 votes
1 answer
138 views

Is Quaternion math really practical knowledge for a graphics programmer?

I've recently had a graphics programmer interview and I was asked about math that is under the hood of quaternions. I briefly mentioned the formulas of using quaternions as rotations, but the ...
0 votes
1 answer
49 views

How to rotate the transform only on the Y?

...
0 votes
0 answers
27 views

Rotating with a preferred direction [duplicate]

I do a RayCast to the terrain and then use the RaycastHit.normal to plant flags. I would like to have the flags to point up with the normal, but have them all face the same direction. As seen in the ...