Такой прикол, единственное что я делаю в коде - меняю родителя, но почему-то _placeTransform далеко от изначальной позиции. _placeTransform - пустышка.
using UnityEngine;
public class PcCase : MonoBehaviour
{
[SerializeField] Transform _placeTransform;
private void OnCollisionEnter(Collision collision)
{
if(collision.collider.GetComponent<Motherboard>())
{
SetMotherboard(collision.collider);
}
}
private void SetMotherboard(Collider motherboard)
{
motherboard.attachedRigidbody.isKinematic = true;
motherboard.attachedRigidbody.useGravity = false;
motherboard.transform.parent = _placeTransform;
motherboard.transform.localPosition = Vector3.zero;
motherboard.transform.rotation = transform.rotation;
}
}