Calculate the X axis only?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sugor

how do I get the X axis only when calculating distance with

I mean, I only want to detect the x position of player if its close to an entity. Any idea how to do that?

:bust_in_silhouette: Reply From: Tsune

If I understand you correctly, you want the distance of Player to Entity on the x-axis?

Try something like this:

distance_vector = Entity.position  - Player.position
x_distance = abs(distance_vector.x)

exactly! Thank you!

Sugor | 2021-11-22 05:24