See the title of the person is not thinking ...
Is it difficult to have a small GL drawing line?
Is it difficult to follow a small object?
Well, really, it's not hard ....
I was thinking the same thing about you from the beginning, but actually, it's different from the theory.
Writing this demo causes this:
The interview to a virtual reality company, because did not go to the company
Directly on the Internet, negotiated the HR estimate is to see if I can be competent
Gave me one, let me to achieve the function of line drawing
Cough, the request is still more meticulous, here we say
Don't say much nonsense, the usual, first on, then directly into the subject
The first one is HR gives me the picture, the second one is my own realization
The requirements are as follows:
1, the model is rotating
2. The line must be above the model
3, the model rotation when the line dynamically adjust to the corresponding position (that is, no matter how the model rotation, the line will always point to the text description of the corresponding site)
4, line start position (pointing to the end of the text description) remain below the text
5. Line end position (point to the 3D model) draw a blue dot
6, such as hands, feet and other similar objects, can be a text description point to two 3D model parts
Corresponding solution: (Draw line with GL)
1, transform. Rotate
2. Set up layer, use two camera, set camera Depth
3, set sub-object, take sub-object world coordinates
4, calculate the width of the text height
Start position x = start position screen x coordinate + text width/2 (x coordinate in middle of text)
Start position y = start position screen y coordinate-text height (y coordinate below text)
5, take the corresponding parts of the world coordinates, and then converted to screen coordinates, in this position to draw a blue dot picture
6, this is too simple--! Set to the same starting position
Recently too busy, the code aspect I do not describe, hope understanding
Ideas have been given out, we can follow the ideas I provide to deal with
If you are having trouble, you can send me a message, you can also download the demo research I provided
Download Link: http://pan.baidu.com/s/1o6oOi1s
This article link: http://www.cnblogs.com/shenggege/p/4222272.html
Unity3d GL Draw Line/object follow/coordinate system conversion