OnMouseDown

using UnityEngine;
using System.Collections;
using System;

public class MouseClick : MonoBehaviour
{
    public float thrust;
    public Rigidbody rb;

    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }

    void OnMouseDown()  
    {
        rb.AddForce(transform.forward * thrust);
        GetComponent<Rigidbody>();
    }
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *