Check out example codes for "unity making homing rocket". It will help you in understanding the concepts better.
Code Example 1
//using the cross-product is quite effective //Note: This is quite usefull for rigidbodys... //but you can also use that for transform with some code adjustments Vector3 targetDir; Vector3 currentDir = transform.forward; //whatever your currentDir is //the cross product returns the axis you want to rotate around Vector3 crossProduct = Vector3.cross(targetDir, currentDir); float magnitude = crossProduct.magnitude; rigidbody.angularVelocity = crossProduct.normalized * speed * magnitude;
Learn ReactJs, React Native from akashmittal.com