N
N
NeoLight32020-07-01 14:09:43
C++ / C#
NeoLight3, 2020-07-01 14:09:43

How to check for Vector3 in C#?

There is an outlon point (Vector3 class variable), how can I make a condition so that if the player crosses the line, the radius of this point is 10.5f?
I managed to make a similar if condition only if the player is exactly on the point itself, but how to do this only with a radius of 10.5f ?

5efc6e98a560d690565307.png

PS the user variable is the player.
user.position - player's location along XY Z axes.
outlon - point with XY Z coordinates.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GFX Data, 2020-07-02
@NeoLight3

Just check distance between points:

var dist = Mathf.Abs(Vector3.Distance(outlon, user.position));
if (dist<10.5f) // попал

Z
zZaKko, 2020-07-01
@zZaKko

Then check not exactly exactly (==), but greater than or less than (>= ; <=).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question