im currently trying to make my character cast a magic spell and play an animation, the animation works great but for some reason its not instantiating at the position of where its supposed to, its always spawning a little to the right and ive tried several different variants of addition and subtraction on a different vector3, how would i get it to spawn where i want it to and additionally how would i get it to move the direction the character is facing?
public GameObject fire;
public Animator anim;
Rigidbody rb;
// Use this for initialization
void Start () {
fire = Resources.Load("fire") as GameObject;
anim = gameObject.GetComponent<Animator>();
rb = fire.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Mouse1)) {
Debug.Log("m1");
Instantiate(fire, transform.position, Quaternion.identity);
anim.SetBool("Fire", true);
}
if (Input.GetKeyUp(KeyCode.Mouse1))
{
anim.SetBool("Fire", false);
}
}