Unity3d GL Draw Line/object follow/coordinate system conversion

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.