using UnityEngine;
public class MotherBoardPlace : MonoBehaviour
{
Collision collision;
private void OnCollisionEnter(Collision collision)
{
this.collision = collision;
switch(collision.collider.tag)
{
case "Processor":
Place("ProcessorPlace", new Vector3(0, 0, 90));
break;
case "ram":
Place("RamPlace", new Vector3(0, 90, 0));
break;
case "CpuFan":
Place("CpuFanPlace", new Vector3(0, 0, 0));
break;
}
}
private void Place(string PlaceName, Vector3 Angle)
{
collision.rigidbody.isKinematic = true;
collision.rigidbody.detectCollisions = false;
collision.rigidbody.useGravity = false;
collision.transform.eulerAngles = Angle;
collision.transform.parent = transform.Find(PlaceName);
collision.transform.localPosition = new Vector3(0, 0, 0);
Grabbing.grab = false;
}
}