Question by
Mr.KBJ · Dec 18, 2015 at 10:46 AM ·
scripting problemmouseposition
How to Shot An Object Toward Mouse's Position
Hello? I'm a student in Korea.. I'm making a puzzle game. but I have a mistake can you teach me how to make an object is shot to mouse's position. this is my script. public class aster : MonoBehaviour { public Vector2 MousePosition;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
MousePosition = Input.mousePosition;
Physics.gravity = Vector3.zero;
if (Input.GetMouseButtonUp(0)) {
GetComponent<Rigidbody>().AddForce(MousePosition);
}
}
void OnCollisionExit(Collision collision){
GameObject.Find ("Stellar").SendMessage ("Out");
}
if you are a korean can you use korean? Because I am not good at English. I;m so sorry...
Comment
Answer by Veerababu.g · Dec 18, 2015 at 12:39 PM
shoot to mouse position means .whenever the u leave the mouse object has to came to the mouse position or what ?