Download

[Solved] Distance To - positive and negative values

I am trying to get a distance to an actor in the world. The problem is that the value is always positive. If the player is getting closer to the actor I want the value to be positive but if the player has passed it I want the value to be negative. This should depend on the world rotation of the object. How to achieve this?


EDIT: Ignore the spelling error :smiley:

Distance is always positive because youโ€™re describing the magnitude of something. Youโ€™d need distance and some kind of angle reference, to determine if it should be positive or negative.

Figured it out.

Check if the Dot Product To is positive or negative. If positive then multiply Distance to by 1, if negative then multiply by -1

1 Like

Or use sign(dotproduct)