I am making a shoot’em up and I want to have objects rotate around my ship like shields. The issue is the ship is moving using velocity, and everything I have found about moving an object around a moving object uses transform.position, which doesn’t get the full job done. When I move the ship, the bolts clump up together.
This is the latest thing I have tried but it did not get the job done:
void Orbit()
{
Rigidbody shipRigidbody = GameObject.FindWithTag ("Plane").GetComponent<Rigidbody> ();
rigidbody.velocity = shipRigidbody.velocity;
Transform Origin = GameObject.FindWithTag("Plane").GetComponent<Transform>();
transform.position = Origin.position + (transform.position - Origin.position).normalized * orbitDistance;
transform.RotateAround (Origin.position, Vector3.up, orbitSpeed * Time.deltaTime);
}