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%.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…