Hey guys, i have a very big problem in my Unity. I saw some videos that show me how to grab an object. An how to put it down again. So my problem is that after I learned to “hold” an object, and release it. It is still on mid air. I tried to use regidbody, but no matter what i do. I can’t figure it out. Hope you will help me from Jaani.
Here is my script:
var onhand : Transform;
function Update () {
}
function OnMouseDown () {
GetComponent.().useGravity = false;
this.transform.position = onhand.position;
this.transform.parent = GameObject.Find("FPSController").transform;
this.transform.parent = GameObject.Find("FirstPersonCharacter").transform;
}
function OnMouseUp () {
this.transform.parent = null;
GetComponent.().UseGravity = true;
}