Check out example codes for "set rotation to velocity unity". It will help you in understanding the concepts better.

Code Example 1

transform.rotation = Quaternion.LookRotation(rigidbody.velocity);

Learn ReactJs, React Native from akashmittal.com