10-30-2018, 03:30 PM
(10-30-2018, 10:15 AM)xcube Wrote: Thank you! It worked! I used tangent incorrectly.
Final code (can someone use to anyone)
Code:Vector3 wheelLocalPos = splinePos.InverseTransformPoint(wheelFrontR.transform.position);
float frontWheelTf = spline.GetNearestPointTF(wheelLocalPos);
tang = spline.GetTangent(frontWheelTf);
wheelFrontR.transform.rotation = Quaternion.LookRotation(tang, new Vector3(0, 1, 0)); // turn wheel
Yes it really works ..