Distance from start point to end point in percentage in update
问题 float curpos = player.transform.position.magnitude; float targetpos=GameObject.Find ("target").transform.position.magnitude; float percentDist = (curCarpos / targetpos) * 100; What I want to do is calculate percentage along the way from current point which is always moving to end point, starting from zero and once it reaches it should be 100. For some reason it is starting from 14% decreasing to 0% and then starting from 0%-99%. 回答1: You do it all wrong. Vectors magnitude in this case it is