Hello,
I have created something like a rope with cylinders and hinge joints (works fine). Every cylinder is a rigidbody and my sphere is a rigidbody, too.
Now I want my sphere attach to my last cylinder on collision. For this I have this:
public GameObject sphere;
public GameObject parent;
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag("Player"))
{
sphere.transform.SetParent(other.transform);
}
}
This works, but my sphere is only a child for a minimum of time and is not really attached to it. So my sphere is not staying on it.
What can I do, that my sphere is attached to it and does the same movement as the parent?
Maybe someone has an idea.
Thank you