I am having troubles trying to figure out what is wrong with my code. I am new at this.
using UnityEngine;
using System.Collections;
public class Shooter : MonoBehaviour {
// Use this for initialization
public Rigidbody bullet;
public float power = 1500f;
public float moveSpeed = 5f;
// Update is called once per frame
void Update () {
float h = Input.GetAxis("Horizontal") * Time.deltaTime *
moveSpeed;
float v = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
transform.Translate(h, v, 0);
if(Input. GetButtonUp("Fire1")){
Rigidbody instance = Instantiate(bullet, transform.position, transform.rotation) as Rigidbody;
Vector3 fwd = transform.TransformDirection(Vector3.forward);
instance.AddForce(fwd * power);
}
}
You don't want to tell us what the compiler error is, what line it's on? Please post the entire error message.
– DaveA