My code has a custom variable called gravity. The player is supposed to align with this gravity so that the players -transform.up == gravity.normalized. Instead the player object spins around like crazy.
if (-transform.up != gravity.normalized) {
transform.rotation *= Quaternion.FromToRotation(-transform.up, gravity.normalized);
Debug.Log(-transform.up); //should print gravity.normalized but does not
}
(Note: the player is not guaranteed to be upright, the rotation changes throughout the game. so maybe theres an issue with global vs local rotation that i don’t understand…?)