How am I supposed to fix the error?
using UnityEngine;
using System.Collections;
public class podnyatie_obj : MonoBehaviour {
float grabPower = 10.0f;
float throwPower = 10;
RaycastHit hit;
float RayDistance = 3.0f;
private bool grabstate = false;
private bool throwstate = false;
Transform offset;
void Update (){
if (Input.GetKey("Grab")){
Physics.Raycast(transform.position, transform.forward, hit, RayDistance);
if(hit.rigidbody){
grabstate = true;
}
}
if (Input.GetKey("Throw")){
if(grabstate){
grabstate = false;
throwstate = true;
}
}
if(grabstate){
if(hit.rigidbody){
hit.rigidbody.velocity = (offset.position - (hit.transform.position + hit.rigidbody.centerOfMass))*grabPower;
}
}
if(throwstate){
if(hit.rigidbody){
hit.rigidbody.velocity = transform.forward * throwPower;
throwstate = false;
}
}
}
}