In particular, the cone-shaped angle effect like the Allied Suicide Squad.
Think about it, think of a few stupid ways, if you have a good way, please tell me
1.Raycast method
Transmitting rays forward from the character position, then debug.drawline
But only the rays are drawn, without the cone effect.
if (Physics.raycast (Transform.position, raydirection, out hit, viewdistance)) { //check the aspect if ( Hit.collider.name! = "Player") { debug.drawline (transform.position, Hit.point, Color.green);} } else { debug.drawline (transform.position, Leftraypoint, Color.green); }
Debug.drawline to be implemented in the Ondrawgizmos () event
2.Spotlight method
The simplest way, the spotlight spotlight is placed horizontally, above the ground, and what you want to project, like the ground, opens in a new layer set to spotlight culling mask to avoid unnecessary illumination.
3. Projection method
The most cheating method, put a conical object above the character, Bo Master in this lazy, with the plane, placed in the camera can not see the place (infinitely high), in a new direction of light, vertical direction, layer settings ibid, want to change the shadow color can write their own shader.
You guys have a better way to tell me.
-----by wolf96 http://blog.csdn.net/wolf96
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Unity3d the idea of the enemy cone angle of view