# Why when the transform position and the radius position is the same it keep changing the transform position?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotateAroundTarget : MonoBehaviour
{
public Transform target;
public float speed;
public Vector3 axis;
public DrawCircle dc;

private bool move = false;

private void Start()
{

move = true;
}

private void Update()
{

{
transform.RotateAround(target.position, axis, speed * Time.deltaTime);
}

{
move = true;
}

if(move)
{
{
float step = 1 * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position,
}
}
}
}


The transform is moving towards the radius position and then should start rotating on the radius.

The problem is that after the transform is reaching the radius position and for example the transform position and the radius position is the same and true :

In this case the position of the transform and the radiusPosition is "(0.0, 0.0, 2.0)" and the condition is true but still it's getting inside and changing the transform position.

So it's not moving between the lines :

transform.RotateAround(target.position, axis, speed * Time.deltaTime);


And

float step = 1 * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position,

The problem is you are using if (transform.position == radiusPosition) and it rarely becomes true because the two vectors are rarely the same. (even if they are visually the same Vector, your programs detects a very small difference like 0.000007)
What you should do is using this code: if(Vector3.Distance(transform.position, radiusPosition) <= 0.2f) And using it, transform.RotateAround(target.position, axis, speed * Time.deltaTime); should be called just as you've expected