Is it possible to use a RayCast (idk know what a raycast is) to select an enemy? Like if i have a variable lets say
And i wanted it if you clicked a object that had the script NPC_AI.cs that this variable would equal that enemy? If it is possible how could i go upon doing this?
Sorry i forgot to include this i have a tag also set up if its an enemy
For a good intro video to raycasting, click here
Also, the Unity documentation is your friend.
You can get the transform of an object that was hit with your raycast.. http://unity3d.com/support/documentation/ScriptReference/RaycastHit-transform.html
More information on raycasts can be found here http://unity3d.com/support/documentation/ScriptReference/Physics.Raycast.html
answered Jul 23 '11 at 05:42 AM