I want to make a script where i can use my “PickUpObject” script and move them into the back of a vehicle and store them there untill n take them out using the “PickUpObject” script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PickUpObject : MonoBehaviour
{
public Transform theDest;
public Player Player;
void Update()
{
}
void OnMouseDown()
{
GetComponent<BoxCollider>().enabled = false;
GetComponent<Rigidbody>().useGravity = false;
this.transform.position = theDest.position;
this.transform.parent = GameObject.Find("Item Dest").transform;
}
void OnMouseUp()
{
GetComponent<BoxCollider>().enabled = true;
this.transform.parent = null;
GetComponent<Rigidbody>().useGravity = true;
}
}