Hello everyone! There is a script for the attraction of two objects - spheres. Faced several problems in it at once Code (CSharp): private HashSet<Rigidbody> affectedBodies = new HashSet<Rigidbody>(); private Rigidbody componentRigidbody; // Start is called before the first frame update void Start() { componentRigidbody = GetComponent<Rigidbody>(); } private void OnTriggerEnter(Collider other) { if ((other.attachedRigidbody != null)) { affectedBodies.Add(other.attachedRigidbody); } } private void OnTriggerExit(Collider other) { if (other.attachedRigidbody != null) { affectedBodies.Remove(other.attachedRigidbody); } } // Update is called once per frame void Update() { foreach (Rigidbody body in affectedBodies) { Vector3 directionToSphere = (transform.position - body.position).normalized; float distance = (transform.position - body.position).magnitude; float strength = body.mass * componentRigidbody.mass / distance; body.AddForce(directionToSphere * strength); } } Because of this part of the script, the balls behave inadequately: when launched, instead of being attracted to each other, they jump up, and then they start to wind in different directions Code (CSharp): Vector3 directionToSphere = (transform.position - body.position).normalized; float distance = (transform.position - body.position).magnitude; float strength = body.mass * componentRigidbody.mass / distance; body.AddForce(directionToSphere * strength); But, if you replace "strength" with a constant, then this will not happen. And still it is not possible to refer to the object by the tag - objects with tag "11" don't react Code (CSharp): private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("11")) { if ((other.attachedRigidbody != null)) { affectedBodies.Add(other.attachedRigidbody); } } }