- Home /
Question by
gaboargen · Jul 22, 2013 at 12:21 PM ·
gameobjectparentingarrowempty
Creating a empty object to not lose children's scale
I want to create an empty object when a proyectile collides with another object, and the make the empty parent.
Like this: Object(parent) <- Empty <- Proyectile
Without the empty object the arrow changes the scale. Also if there's another method to do this please tell me.
this is the code I am using
function OnCollisionEnter(target : Collision)
{
transform.parent = target.transform;
Destroy (rigidbody);
Destroy (collider);
}
thank you!
arrow.png
(165.4 kB)
Comment
edit: adding an empty object seems to not work, any clue to how to keep the scale?
Answer by dorpeleg · Jul 22, 2013 at 12:53 PM
Try adding an "original scale" var.
Save the scale of the object before the parent change.
Once you change the parent, set the scale back to original.
Play around with Scale and localScale, see if it helps.