Screen shots will be able to explain better then I can. So there are a couple below.
I am trying to get my projectiles to fire in the direction of the large sphere. As you can see, that’s not exactly happening. Their rotation direction seems to change drastically too between the two positions where they were fired from.
Here comes the odd part, when I pass the same direction to the raycast, it works fine. As shown by the 5 red rays all pointing at the sphere. I’ve done rotating to a vector direction many many times and it’s always worked.
The “this” is the hardpoint they are being created at, which resides at the center of the face where the yellow ray cast is originating from. Anyone able to hazard a guess as to where my problem may lie? I’ve been working on this all night and I’m pretty stumped.
GameObject phaserBolt = Instantiate(Resources.Load("Prefabs/PhaserBolt")) as GameObject;
phaserBolt.transform.position = this.transform.position;
Vector3 direction = (target.transform.position - phaserBolt.transform.position);
Vector3 directionNorm = direction.normalized;
phaserBolt.transform.rotation = Quaternion.LookRotation(directionNorm, Vector3.up);
Debug.DrawRay(phaserBolt.transform.position, directionNorm * direction.magnitude, Color.red, 2f);