Hello Community,
I have a GameObject (Plate) with the Scale (X=13 / Y=1 / Z=7)
and a GameObject (Item) with the Scale (X=1 / Y=0.05 / Z=1)
Now I have Script on the Plate (AttachItemScript)
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Item")
{
other.transform.parent = transform;
}
}
private void OnTriggerExit(Collider other)
{
if (other.tag == "Item")
{
other.gameObject.transform.parent = null;
}
}
The Plate is moving and the item should moved too, (OnTriggerEnter).
It’s possible, that an item can leave the plate (OnTriggerExit).
The Problem is, sometimes the Item exit the plate and the scale of the item is changing.
How can I avoid this?