I have a snippet of code:
Quaternion _rot = Quaternion.LookRotation(new Vector3(_waypoints[_waypoint].x, _waypoints[_waypoint].y, 0) - _transform.position, _transform.up);
_transform.rotation = Quaternion.Slerp(_transform.rotation, _rot, (Time.deltaTime*1.5f));
The vector full of waypoints changes to the next one every time the character meets a waypoint. The character is moving in X and y, not in X. This script is meant to rotate a GameObject over time to have it’s transform.forward (z) facing the next Waypoint (Vector3, without a Z coordinate)
My question is, what do I need to do in order to make the GameObject’s transform.right (x) face the next waypoint, instead of its transform,forward(z).