A clipped indicator

Submitted by rootmaster on Mon, 06/18/2018 - 13:05

Initial state:

initial state

Handle collision:

different situation

The idea:


red line are block line which will block the indicator. connect the zero point of the indicator to the block edge start/end point. identify the area is a blocked area or a gap. indicator will go through the gap area which will build a relative small  fan to the full length of the indicator.

Besides, to make a fan shape, some still edges were used as seen in Initial state picture. these edges need intersection calculation with the blocked red line.

Handle collision picture situation 4 is special because block line doesn't intersect will any still edges. only small party of the fan arch. need another fan arch intersection with still edge calculation.

Make fan angel can be dynamic changeable:

the texture:

indicator texture

the idea:

angle changeable

2 L shape with an arch. Sample the texture with arch on upper side and the L part in lower center. arch is some kind of circle sampling , L is a rectangle sampling way.

the very first and very last part of the fan need a rectangle style sampling.

different way of sampling

turn off mip map so the edge of the texture pix won't blurred out. the connect won't be perfect because they sample in different way.

make small transparent part somewhere near the zero point of the fan. because it will be too sharp for the rectangle sampling near the zero point. 


Handle the Battle Map

2-D Map.

2D-Map data. grey part are examples of no walk-able area which will load walls or ... to block the player's skill/bullet or walk.

internal data may be something like this exampleMap[i,j] = true.

use recursive functions to divide small grep rectangles in this map into 4 big block area.

then the coming problem is to find the block area border. I C L H like-closed shape border lines used to block the indicator.


what is a border edge. define it like this a edge which one side of block is walk-able and another side is no-walk-able.  Loop through into the block area blocks, we will find a collection of border edges of this block area. In the above picture , take border edge 1,2,3 for example need to merge these 3 edges into one to make our indicator intersection calculation run more faster.


sort the border edge by the block index i,j .

check the 2 border edge near each other. if the next border edge is in j direction(like this current block is[3,3], next block is[3,4]), and both of the two border edge is BOTTOM_BORDER_EDGE. then the two edge can be merged in j direction.

after j direction finish, check i direction.

then we get merged border edges which exactly represent the border of the block area.


If  some of the block are destroyed by some kind of skill. and been marked as walk-able in real-time. then just need to update the related block area border edges in the same way no need to update all the map.

Need memory pool to cache the run-time vector3 ray ... data to avoid GC .