Hello! Need help!
In first script have:
public void shootingFunction(){
if(Input.GetMouseButtonDown(0) && Time.time > nextFire && isDead == false){
// The screen has been touched so store the touch
Touch touch = Input.GetTouch(0);
cameraComponent = GameObject.Find("CameraShot").GetComponent<Transform>();
cameraComponent.transform.position = -Dude.transform.position;
coorTouch = camaraShot.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, 10));
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
}
}
and, in other script:
void OnEnable()
{
bullet.velocity = transform.TransformDirection (gameController.coordenadasTouch) * speed ;
}
ITS ALL OKEY! BUUUUUUUT!
It varies the speed where I touch the screen on the device. If I touch the screen at the top is very fast, if I touch near where the shot is generated is very slow!
How do I make the speed handle “speed”???
Transform.TransformDirection???