Cant made the object do smthing after its not in raycast anymore
if(Physics.Raycast (camera.transform.position, fwd, out raycast, distance) & raycast.transform.tag == "Object")
{
if(raycast.rigidbody)
{
PlayerPrefs.SetString("PulledObj", this.raycast.transform.name);
if(Input.GetMouseButton(1))
{
this.gravObj.GetComponent<Rigidbody>().AddForce((camera.transform.position-raycast.transform.position).normalized*pullForce/50,ForceMode.VelocityChange);
if(raycast.distance<stopDistance)
{
this.raycast.transform.GetComponent<Rigidbody>().velocity = Vector3.zero;
this.raycast.transform.GetComponent<Rigidbody>().Sleep();
this.raycast.transform.GetComponent<Rigidbody>().useGravity=false;
this.raycast.transform.SetParent(gravyGun.transform);
this.raycast.transform.rotation = Quaternion.Slerp(raycast.transform.rotation, Quaternion.LookRotation(camera.transform.position - raycast.transform.position), 100f * Time.deltaTime);
click=2;
}
}
else if(raycast.rigidbody==null)
{
this.gravObj.transform.GetComponent<Rigidbody>().useGravity=true;
this.gravObj.transform.parent=null;
click=1;
}
}