Ray cast to object to transform, instead all objects with script transform.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class PickUp : MonoBehaviour
 {
   
     public Transform theDest;
     private bool hasPlayer = false;
     private bool beingCarried = false;
     private bool touched = false;
     public Camera fpsCam;
     RaycastHit hit; 
 
 
 
     void FixedUpdate()
     {
 
         if  (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward , out hit, 5.5f))
         {
             hasPlayer = true;
         }
         else
         {
             hasPlayer = false;
         }
 
         if (hasPlayer && Input.GetMouseButton(1))
         {
             GetComponent<Rigidbody>().useGravity = false;
             GetComponent<Rigidbody>().freezeRotation = true;
             this.transform.position = theDest.position;
             this.transform.parent = GameObject.Find("Destination").transform;
             beingCarried = true;
         }
         else
         {
             this.transform.parent = null;
             GetComponent<Rigidbody>().useGravity = true;
             GetComponent<Rigidbody>().freezeRotation = false;
         }
 
  
 
     }
 }
 
               Hello, This is a script designed for pick up object with an FPS Camera. This script is applied to each object I would like to pick up. The problem is, when i pick up one object with the script, they all transform to the one I'm holding. I also cant differentiate with separate tags because this needs to be implemented on a large scale and procedural. Any help would be much appreciated. Thanks.
               Comment
              
 
               
              Your answer