- Home /
Changing parent on collision
Let's say I have 2 cubes, cubeA, cubeB and cubeC. I want to have it so when cubeA or cubeC hits cubeB, the cube's parent is changed to cubeB's parent. I have attempted to do this myself, however the variables that I get relating to the colliding cube is read-only, so I can't get it to change parents.
Answer by Jeff-Kesselman · May 11, 2014 at 11:28 PM
cubeA.transform.parent = cubeB.transform.parent;
Thats all you need to do. If you are having trouble with that then there is something else wrong with your code and you need to show it to us.
I rephrased the question. The problem was relating to the cube through OnCollisionEnter(newcube)
Your answer
Follow this Question
Related Questions
Collision isn't detected between two obects 1 Answer
[VIDEO]how to collision.transform.parent = transform.position ?(Parenting) 1 Answer
Object Collision PLEASE HELP!!! 1 Answer
Child calling parent's OnTriggerEnter when no Rigidbody is attached to child 1 Answer
Trying to proceed to next level when multiple items have collided 1 Answer