Skip to main content
added 107 characters in body
Source Link
Arian_ki
  • 691
  • 5
  • 25

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

The problem is you are using if (transform.position == radiusPosition) and it rarely becomes true because the two vectors are rarely the same.

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

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

Source Link
Arian_ki
  • 691
  • 5
  • 25

The problem is you are using if (transform.position == radiusPosition) and it rarely becomes true because the two vectors are rarely the same.

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