- Home /
Becoming parent after OnTriggerStay/Enter?
Hi,
I have one question. Object that is controled by player has a collider that is trigger and when it collides with other object i want them to become "a part of him", like they are glued together, and to go wherever he is going.
Is that possible?
Answer by Statement · Mar 09, 2011 at 02:13 PM
Just parent it.
other.transform.parent = transform;
In case the object had any other movement code, you might want to disable it. For example remove any rigidbodies (or possibly make them kinematic but I don't know by heart if it carries over well to parented objects).
All of my objects have rigidbodies, so thank you for pointing that out.
Thanks a lot!
Your answer
Follow this Question
Related Questions
Make a simple tree 1 Answer
Parenting On Trigger not Working? 3 Answers
OnTriggerEnter - check if collider is child 1 Answer
Update a parent owned Script from within a child script 0 Answers
How to Instantiate Prefab as Child of Player OnTriggerEnter 0 Answers