Enemy Character Controller


I’m looking for some advice, I’ve got an enemy character with a character controller attached to him and he patrols some waypoints and if the player comes into range he will attack ether by running at you, squatting and shooting or he will shot at you while lying down.

My problem is when the player shoots at him while he is patrolling thats fine because the raycast hits his character controller capsule, but when he squats or is lying down because the character controller capsule stays upright you can kill him by shooting above him and the raycast will detect the capsule.

So any suggestions how best to go about this?

All you have to do is either rotate or scale the collider of the character. That will allow the raycast to pass above the character without it hitting the collider. If the character model is childed to the character controller (which i’m asuming it is…) then you might have to compensate for the rotation/scaling by doing the opposite to the character model itself.