- Home /
Question by
ZroeX · Oct 26, 2011 at 11:52 AM ·
gameobjectstick
How to get a object to stick another object?
I let a gameobject move to touch another gameobject.
And when they touch the two gameobject will be stick together.
How to do the result?
Comment
Best Answer
Answer by mrDude · Oct 26, 2011 at 11:59 AM
Code an OnCollisionEnter() event and simply say: transform.parent = target.transform;
doing that causes the attached object to jump to the scale of the parent, and other bizarre behavior, including getting stuck on the player themselves. Write a script that tells the attached object to maintain the same rotation but position at a constant angle and distance (spherical coordinates) from the parent.