Hello, So I have an arrow prefab with ArrowDamage script on it.
It is rotated the way i want. Then on my main camera i have a shooting script.
However when i shoot the arrow comes out correctly but it is straight up and down instead of away from em like an arrow is when its shot? Why?
Thanks!
ArrowDamage:
using UnityEngine;
using System.Collections;
public class ArrowDamage : MonoBehaviour {
public int Damage = 25;
void OnCollisionEnter(Collision info) {
info.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
}
}
PrefabShooting:
using UnityEngine;
using System.Collections;
public class PrefabShooting : MonoBehaviour
{
public Rigidbody theBullet;
public int speed = 40;
public float timer = 0.7F;
void Update()
{
timer -= Time.deltaTime;
if (Input.GetMouseButtonDown (0)) {
if (timer <= 0) {
Rigidbody clone = Instantiate (theBullet, transform.position, transform.rotation) as Rigidbody;
clone.velocity = transform.TransformDirection (Vector3.forward * speed);
Destroy (clone.gameObject, 2);
timer = 0.7F;
}
}
}
}