- Home /
Question by
kpannirudh · Aug 14, 2017 at 09:51 AM ·
scripting problemplayerenemy
How to script a enemy so that he shoots the player when he is within a certain radius with respect to player (Unity 3D)?
I am beginner to Unity(3d). I am making a game where the enemy chases the player and when he is within a certain radius, say 2, he needs to shoot the player(In all co-ordinates[x,y,z]). How to script for this in C#?
Comment
Physics.CheckSphere for 3D and Physics2D.OverlapCircle for 2D
Your answer
Follow this Question
Related Questions
When the enemy character shoots, the bullet won't go to the position of my player! 2 Answers
enemy AI doesnt work when enemy is spawned but does if it is already in the scene 1 Answer
How to see an enemy from certain distance and change texture 2 Answers
Script Wont Take away health from my player when hit by enemy bullet. 0 Answers
teleportation problems (2d) 1 Answer