I’m doing a mouse collision with one object and I want to enable isKinematic of his children…
Any idea to do that ? Am I doing Wrong ? This script is on Gameobject that I want to take the children
public class MouseDrag : MonoBehaviour
{
public GameObject fruit;
void Start()
{
fruit = GameObject.Find("Fruta");
}
Vector3 screenPoint;
Vector3 offset;
void OnMouseDown()
{
screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
}
void OnMouseOver()
{
if(transform.gameObject.tag == "Player")
{
print ("worked");
gameObject.GetComponentInChildren<Rigidbody>().isKinematic = false;
//rigidbody.isKinematic = false;
}
}