surfaceNormal = gravityCentre.transform.position - transform.position;
surfaceNormal.Normalize();
new_forward = Vector3.Cross(surfaceNormal, transform.right);
I am trying to get a character to walk around a sphere. I have realised this code has an issue in transform.right moves as I adjust the chacter which I believe is giving me issues. Is there a generic way for me to find transform.right?
Would this still work if I read off the the transforms y localrotation which should tell me which way the character is meant to be facing.
In my head I am thinking I know how much my character is rotated and i know the surface normal, now how can I use those 2 things to determine what the forward vector should be? I could just put it into a blank vector3(0,rotation,0) and normalise it, but no idea what to do next.
Please help me :)