#pragma strict
var move : float;
var go : GameObject;
var charScale : Vector3;
var prefab : GameObject;
var distance = 150.0;
private var rate_time : float;
var rate : float = .5;
function Start () {
}
function Update () {
if(Input.GetAxis("Fire_bullet") == 1 Time.time > rate_time)
{
var position = Vector3(Input.mousePosition.x, Input.mousePosition.y, distance);
position = Camera.main.ScreenToWorldPoint(position);
go = Instantiate(prefab, transform.position, Quaternion.identity ) as GameObject;
go.transform.LookAt(position);
go.rigidbody2D.AddForce(go.transform.forward * 1000);
rate_time = Time.time + rate;
}
}
this is the code i have so far, it works perfect in the sense that the bullet gets shot based on the position of the cursor, however, the rotation is always fixed and points to the right, how can i make the bullet tip point towards where is it going? thank you in advance