private float speed = 50.0f;
transform.RotateAround(spawnTransform.position, Vector3.up, (Time.deltaTime * speed * direction));
How would I calculate the object’s speed in meters/second from the code above?
private float speed = 50.0f;
transform.RotateAround(spawnTransform.position, Vector3.up, (Time.deltaTime * speed * direction));
How would I calculate the object’s speed in meters/second from the code above?
You just rotate at a certain angular speed. Just convert the angle / second into radians / second so you get the distance traveled on the unit circle. Then just multiply by your “radius” of your circular motion and you get the distance traveled along the circular path per second:
concrete it would look like this:
float angularSpeed = speed * direction * Mathf.Deg2Rad; // rad/sec
float travelSpeed = angularSpeed * Vector3.Distance(transform.position, spawnTransform.position);