Unity3d Small opposed common scripting API (transform, time, Random)

Source: Internet
Author: User

The Unity engine provides a rich set of components and class libraries, so I'll give you a brief introduction to the transform, time, and Random that I use more often.

One, transform components

The transform component determines the position, orientation, and scale of the game object, which is used to set the camera's viewing angle and update the player's position.

member variables and member functions are not listed first, there are in the Holy Scriptures.

Simply say the application:

1, around its own axis y rotation

float speed = 30.0f;

Transform. Rotate (Vectoe3.up*time.deltatime*speed);

2. Move forward

float speed = 30.0f;

Transform. Translate (Vector3.forward*time.deltatime*speed);

3, around the world axis y rotation

float speed = 30.0f;

Transform. Rotatearound (Vector3.zero, Vector3.up, speed*time.deltatime);

Second, time

Time-related.

1, the game from the beginning to now experience the time

2, Deltatime time spent on a frame

Third, Random

Generate random numbers, rotations, random things.

Rotation: Random rotation

Random floating-point number from value:0 to 1, including 01

Unity3d Small opposed common scripting API (transform, time, Random)

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.