Question by
roscate80 · Dec 29, 2018 at 06:19 PM ·
scripting problemscript.objectrigidbody2dscriptingproblem
Problem with the cloning object :(
Hello there,
I m creating my first game and I ve passed trough a few issues. So basically when an object falls from sky and touch the platform , it becomes a child of the platform. I did this by setting the object to kinematic and then to delete the rigidbody2d.
void OnCollisionEnter2D(Collision2D collision)
{
//If the object that is colliding has the tag "Tag"
if (collision.gameObject.tag == "object")
{
rb.isKinematic = true;
Destroy(rb);
//Set the parent of that object to the platform
object.transform.parent = GameObject.Find("platform").transform;
}
}
But the problem is that the clone objects that falls also from sky, they are stuck in the sky because they are set as kinematic too, even if I set at Start function
private void Start()
{
rb = object.GetComponent<Rigidbody2D>();
rb.isKinematic = false;
}
Att, Rafael
Comment