Hello everyone,
i am trying to get my feet wet with Unity and what i want to do is sticking an object to another one on contact, so if one of the objects which are glued together moves, the other moves relatively.
I read some threads and they come up with rather simliar scripts so i tried it this way:
void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Glueable")
{
other.transform.parent = gameObject.transform;
}
}
I understand that the effect should be making the hit object a child to the hitting object so they move together.
I tested this but the hit object just makes some little funny moves (not relative to the theoretical new parent) before it falls through the floor -.-
Why does that happen? It seems there are aspects that i don’t understand. Is it the right method to achieve what i want in the first place.
Any help is appreciated ![]()
No problem :D
– KittenSnipes