- Home /
How to make Ray collide with Character controller ?
For More Details :
http://postimg.org/image/ao8mrszz7/ [please take a look]
Raycasts require colliders. Character Controllers by default don't have colliders. $$anonymous$$ixing colliders and character controllers is problematic. But if you specify what problem you are trying to solve with your Raycast, there might be an alternate solution. For example a typical reason for an enemy to raycast towards the player is to deter$$anonymous$$e if he can see the player. As an alternate, you can do a Physics.Linecast() between enemy and the position of the player. If it hits nothing then the enemy has an unobstructed view of the pivot point of the character.
@robertbu Technically the CharacterController is a collider. As seen in the docs, it even inherits from Collider
. Raycasting should collider with CharacterControllers, in this case it must be some other problem, such as layer masks etc.. XD
@AI Jawi, you need to post more information for us to be able to answer your question :)
Answer by Benproductions1 · Aug 19, 2013 at 08:12 AM
http://lmgtfy.com?q=Unity+Raycast+Character+Controller