if position in world = x javascript

How would I create an if stament that would do something like this:

if(position in world = 3)
{
dosomething();
}

A position would typically be a 2-d or 3-d coordinate, not a scalar, so ‘position == 3’ doesn’t make much sense.

Can you clarify what you mean exactly?

oh ya kinda forgot about 3d. A better example would be:

if(object position in world = (3,0,0))
{
dosomethine();
}

Comparing coordinates exactly will rarely be effective due to floating-point imprecision. Here are two alternatives though:

  1. Compute the distance between the entity position and the target position. If the distance is below some threshold, consider the entity to have reached the position.

  2. Place a trigger of the desired dimensions at the target position and take the appropriate action in the ‘on trigger enter’ callback.