Question by
3picSexyCalvin · Jul 18, 2016 at 04:50 AM ·
rigidbodydestroyparent-child
Delete the parents and give the children an rigidbody
i was wondering if there is a way where in that if the parents is deleted that the children would remain but they all would get a rigidbody so that my character would fall apart.
here is a preview of the code i got
void OnCollisionEnter(Collision BouncyPlatform)
{
if (BouncyPlatform.gameObject.tag == "BouncyPlatform")
{
GetComponent<Rigidbody>().AddForce(new Vector3(0, Bounce, 0));
Debug.Log("BOUNCE");
transform.DetachChildren();
Destroy(gameObject);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612085031im_/https://answers.unity.com/themes/thub/images/avi.jpg)