Share my March 2014 unity3d Interview Questions and answers

Source: Internet
Author: User

In June, I interviewed unity3d game programs, prepared interview questions, asked me a few questions about game development, asked me how to use English, and so on. I introduced the company's situation and requirements for the unity3d program. Then I came back. It took less than one and a half hours. The test answer is poor. Next, I will share my unity3d pen question. The answer is what I did. If you have any errors or better answers, you are welcome to correct them.



1. C # program questions

Private static void aaa (int x) {x = 10;} private static void bbb (ref int x) {x = 10;} static void Main (string [] args) {int x = 0; aaa (x); // the current value of x is ___ bbb (ref x); // the current value of x is :___}

  

 

Answer: 0, 10.

One is to copy a value, and the other is to pass the address

 

2. English translation (Translate the following text into Chinese)

Transform. LocalPosition

Var localPosition: Vector3;

Description:

Position of the transform relative to the parent transform.

If the transform has no parent, it is the same as Transform. position.

Note that the parent transform's world rotation and scale are applied to the local position when calculating the world position. this means that while 1 unit in Transform. position is always 1 unit in transform. localPosition will get scaled by the scale of all ancestors.

Description:

The position of the transformation relative to the parent level.

If the Transform has no parent level, it is equivalent to Transform. position.

Note: When calculating the location of the world, the world rotation and scaling of the parent-level transformation are applied to its own location. Transform. 1 unit of position is 1 unit, Transform. one unit of localPosition will be scaled by the scaling of all the Ancestors. Simply put, the unit of one unit of its own position will be affected by the scaling of all its superiors.

The article comes from the unity holy book, refer to the http://game.ceeger.com/Script/Transform/Transform.localPosition.html

 

 

3. U3D provides a class for saving and reading data (playerprefs). Please list the functions for saving and reading integer data.

Answer: PlayerPrefs. SetInt ();

Answers:

The PlayerPrefs class can be used to store and read three basic data types: float, integer, and string. The methods involved are as follows:

SetFloat (); Save the floating point type

SetInt (); Save the integer

SetString (); Save the string type

GetFloat (); get the floating point type

GetInt (); get integer

GetString (); get the string

 

4. Briefly describe the meaning of vector point multiplication:

Vector u point multiplication vector v;The product of the length of u and the projection length of v on u. It is a scalar and can be positive or negative.

Refer:

Http://hi.baidu.com/cly84920/item/7bc79fdf97ff4f91260ae733

Http://wenku.baidu.com/link? Url = Response

 

5. What are the necessary conditions for collision of objects.

Answer: both objects must carry a Collider, and one of them must also carry a Rigidbody rigid body.

 

6. Program question: what is the meaning of the aaa () function and what is output on the console after test () is executed?

Public delegate void DoHurt ();

Protected DoHurt hurtCall;


Public void aaa (DoHurt call) {this. hurtCall = (DoHurt) Delegate. combine (this. hurtCall, call);} public void myHurt001 () {Debug. log ("Call 1");} public void myhurt002 (int a, int B) {Debug. log ("Call 2");} public void test () {this. aaa (myHurt001); this. aaa (myHurt002); this. hurtCall ();}

  

Answer: It seems that this. aaa (myHurt002) will report an error.

A: If hurtCall is null and call is not null, the principal variable hurtCall points to the method pointed to by call. If hurtCall is not null and call is null, the principal variable hurtCall points to the method that hurtCall points. The parameter of the aaa method is a delegate variable without parameters, which points to myHurt002, while myHurt002 is a parametric method. You are welcome to discuss this question.

 

7. Game object B is A sub-object of game object A. After game object A is rotated, write the script statement that game object B rotates around its Y axis, and the script Statement of game object B's Y axis rotation around the world coordinates.

Object B rotates around its own Y axis: B. transform. Rotate (Vector. up );

The Y-axis rotation of object B around the world coordinates: B. transform. RotateAround (Vector. up );

Transform. Rotate (); used to set the self-rotation of a model;Transform. RotateAround (); used to set the model to rotate around a certain point.

Vector. right: X axis direction;

Vector. up: Y axis direction;

Vector. forward: Z axis direction.

 

8. known coordinates of the points A and B in the three-dimensional space, please write out the calculation function of the distance between the two points on the X-Z plane.

In fact, it is to find the projection distance between A and B on the XOZ plane. After projection, Y coordinates are equal to 0, X and Z remain unchanged. The distance between AB projection is the sum of the square of the difference between two X coordinates and two zcoordinates, and then the square.

 

AI is unfamiliar. In the study...

Related Article

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.