#Aligning a 3rd person controller to dynamically changing gravity

1 messages · Page 1 of 1 (latest)

uneven yacht
#

I assumed that quaternion.lookrotation would be the best option as I need to rotate the character in relation to the camera in addition to the surface normal, but it doesn't behave as I expect it to

#

The problem is especially weird on planetary movement. It does align the character to the ground, but movement controls behave strangely, as it seems to turn on its own even when only 1 direction is pressed.

cobalt bluff
#

LookRotation is certainly what I'd use. It's a complex topic though, a lot of cross products involved to get all the axes you need to achieve whatever you want. I'm not sure if there's tutorials that cover it specifically, but catlike coding's movement series will cover the general knowledge for that sort of thing https://catlikecoding.com/unity/tutorials/movement/custom-gravity/

uneven yacht
#

As per my understanding so far, the lookrotation implementation would look something like this correct? (Pseudo code)

rotation = Quaternion.LookRotation( camera pointing direction, -gravity vector)

cobalt bluff
#

Yes, that seems correct