Yard counter

hello guys, you have helped me a lot and I have learned a lot here, so I bring another question that I still don’t see an XD light. The problem is this, I am playing a game of golf, and usually after taking the shot there is a “yard counter” to know the distance the ball has traveled. I have no idea how to do this XD. I am using ApplyMovement and applyForce to move the ball, but I would also like to display the distance it has traveled. Can someone help me ?

super simple. dist = (endpos-startpos).length

or more completely:

## these are Vectors that can do maths ##
startpos = player.worldPosition  
endpos = ballobj.worldPosition

## the result of the vector math is another vector which has a "length" ##
dist = (endpos-startpos).length
1 Like

Man, thank you very much, XD. It really is quite simple, I am still very new to python XD. Anyway thank you very much.

by the way, forgot to mention. that is gonna be in meters (blender units), so be sure add the yards conversion formula.

1 Like