I am having trouble in making a cillinder show a message when it hits an Enemy. I was seeing a video about Counter-Strike when i thought “Oh, it would be a nice idea to use that same system!” Most FPS games use an invisible line that when find an enemy, activate a trigger that will make the enemy be hit instantly.
This makes impossible for the enemy to dodge hits, but it is very easy to make and pretty nice by the way. It would reduce my things to do list for now (i am developing the enemy) in my FPS.
The problem is that something is wrong here… I don’t know if it is bcs i have been studying literally 3 different programming languages and i am kinda forgotting the basic things sometimes, but something is wrong with my script.
I made a simple script for now that WAS SUPPOSED to detect any gameobject that collide with my cillinder. When it collides, the script will detect if it is an enemy by searching if it is tagged as “Enemy”. (Javascript)
function OnCollisionEnter (Aim : Collision)
{
if(Aim.gameObject.tag == "Enemy")
{
Debug.Log ("TARGET HIT!");
}
}
The problem is that basically… It doesn’t show the log! Why? I also changed it to just (Collision: Collision) and nothing changes, the log isn’t shown. My cillinder does have a collider, the enemy does have a collider, i don’t understand! Is it because i have two cameras or something? Also my cillinder is passing through objects. =(
Edit: Here are two screen shots. One is of my current test cillinder, and the other is from the Enemy. Hope it helps!

