Hi,
So I have this script:
using UnityEngine;
using System.Collections;
public class MouseLook : MonoBehaviour {
public int fireRate;
public float lookSensitivity = 5f;
public float xRotation;
public float yRotation;
public Rigidbody bullet;
public Transform barrelEnd1;
public Transform barrelEnd2;
public Transform barrelEnd3;
public Transform barrelEnd4;
void Start () {
}
void Update() {
xRotation += Input.GetAxis ("Mouse Y") * lookSensitivity;
yRotation -= Input.GetAxis ("Mouse X") * lookSensitivity;
xRotation = Mathf.Clamp (xRotation, 0, 0);
transform.rotation = Quaternion.Euler (xRotation, yRotation, 0);
if (Input.GetMouseButton (0)) {
Rigidbody bulletInstance;
bulletInstance = Instantiate (bullet, barrelEnd1.position, barrelEnd1.rotation) as Rigidbody;
bulletInstance.AddForce (barrelEnd1.forward * fireRate);
bulletInstance = Instantiate (bullet, barrelEnd2.position, barrelEnd2.rotation) as Rigidbody;
bulletInstance.AddForce (barrelEnd2.forward * fireRate);
bulletInstance = Instantiate (bullet, barrelEnd3.position, barrelEnd3.rotation) as Rigidbody;
bulletInstance.AddForce (barrelEnd3.forward * fireRate);
bulletInstance = Instantiate (bullet, barrelEnd4.position, barrelEnd4.rotation) as Rigidbody;
bulletInstance.AddForce (barrelEnd4.forward * fireRate);
}
}
}
I would like to make it so that instead of using the mouse position to rotate the player, I want to be able to drag my finger of the screen instead.
Any ideas? @Mmmpies
Thanks,