[Unity3d self-learning Record] unity3d self-made watch

Source: Internet
Author: User

Today, I wrote a small watch, but it was actually very simple. I used it in ouarla.

First, create the clock, minute, second, and four points (, and ~~ Not that much.

The clock, minute, and second are the three parent-level centers. We need to note that we rotate the parent-level orah.

(Child-level vertices in the parent-level center)

Next we will write the code as follows:

Using unityengine; using system. collections; public class clock: monobehaviour {public transform Shi; Public transform fen; Public transform Miao; // use this for initializationvoid start () {}// update is called once per framevoid Update () {debug. log ("Hour" + system. datetime. now. hour); debug. log ("Minute" + system. datetime. now. minute); debug. log ("seconds" + system. datetime. now. second); // float miaonum = system. datetime. now. second * 6f; Miao. eulerangles = new vector3 (Miao. position. x, Miao. position. y,-miaonum); // minute float fennum = system. datetime. now. minute * 6f; fen. eulerangles = new vector3 (fen. position. x, Fen. position. y,-fennum); // hourly float shinum = system. datetime. now. hour * 6f; Shi. eulerangles = new vector3 (Shi. position. x, Shi. position. y,-shinum );}}

All values need to be * 6, because a total of 60 seconds, a circle is 360 degrees, and 1 second is 6 degrees.

It's easy to write.

Don't laugh...

:


[Unity3d self-learning Record] unity3d self-made watch

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.