Linked Questions

67 votes
2 answers

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 ...
DMGregory's user avatar
  • 135k
1 vote
1 answer

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: ...
Nikolas Adair's user avatar
0 votes
2 answers

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 ...
Kyohei Kaneko's user avatar
0 votes
1 answer

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 ...
The Dreams Wind's user avatar
0 votes
1 answer

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....
Samuel Fyckes's user avatar
0 votes
1 answer

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: ...
Shromi's user avatar
  • 115
0 votes
1 answer

How to rotate the transform only on the Y?

Daniel Lip's user avatar
  • 1,757
0 votes
1 answer

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

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: ...
Ugo Hed's user avatar
  • 281
0 votes
1 answer

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 ...
LeytonMate's user avatar
0 votes
0 answers

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 ...
Charl Cillie's user avatar