I am a little new to Unity 3D. I have searched the forum on this subject and could not find an answer.
I have taken the missile example scripts from the FPS example and created a 2D PLANE where multiple enemy cubes roll around the outside of the plane and a missile turret in the middle fires at them.
Here are my 2 issues:
-
When the turret finds the closest target in range, it will stay focused on that target until it is out of range. How do I pass the target name to the projectile I am firing? I read a lot about instantiated projectiles but couldn’t quite figure this one out. If I can’t pass the target name to the projectile then I am guessing that while I update the trajectory of the missile, it will change target if a different target becomes closer (which I don’t want).
-
I am new to the whole Vector thing and couldn’t figure out how to rotate and change the direction of the projectile. I am guessing the code goes in the Update statement of the instantiated projectile, and I am guessing you rotate the projectile towards the target and change the direction, but just need a little help getting there.
I appreciate any assistance. So far these forums have been a huge help to me.
Thanks in advance.