unity terrain rotate code example
Example: unity rotate player based on terrain
upright = Vector3.Cross(transform.right, -(fHit.point - bHit.point).normalized) transform.rotation = Quaternion.LookRotation(Vector3.Cross(transform.right, upright));
upright = Vector3.Cross(transform.right, -(fHit.point - bHit.point).normalized) transform.rotation = Quaternion.LookRotation(Vector3.Cross(transform.right, upright));