Hi,
I am trying to fire a raycast from the centre of my screen and am experiencing problems. I’ve attached a video and code.
^ Although the video is short and very quick, it should show that the projectile is being shot from my position, but not factoring in any direction.
if(Input.GetMouseButtonDown(0))
{
var effectInstance = Instantiate(SomeEffect, Camera.main.transform.position, new Quaternion()) as GameObject;
var effectSettings = effectInstance.GetComponent<EffectSettings>();
effectSettings.UseMoveVector = true;
effectSettings.MoveVector = Camera.main.transform.forward + Camera.main.transform.position; //or you can use effectSettings.MoveVector = Camera.main.transform.forward + Camera.main.transform.position
}
Do I need to do anything special to assign the rotation of my camera? That is the only thing I think I am missing here, but I have had someone look at the code and verify that in their opinion everything should be working fine.