private Transform GetClosest(Transform transformA, Transform transformB)
{
var distToA = Vector3.Distance(transform.position, transformA.position);
var distToB = Vector3.Distance(transform.position, transformB.position);
if (distToB < distToA)
{
transformA = transformB;
}
var finalTransford = transformA;
return finalTransford;
}
Hi,
Good job on challenging yourself by writing your own code. Did you test your it? Does it work? If so, it’s a solution.
See also:
- Forum User Guides : How to mark a topic as solved
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.