Watch and Clock
(日本語 /hseki-portfolio-jp/Watch_and_Clock)
https://scrapbox.io/files/6155c93ec5648b001df72e37.jpg https://scrapbox.io/files/61557eb8cff5c7001d9cbbb4.jpg
A watch/clock that can shows current time on Unity. I call them just clock here.
Tools Unity, Affinity Photo,(Scripting with C#, modeling on Blender)
/icons/hr.icon
Unity and Scripting
https://scrapbox.io/files/615588bad77b6600209e9e8a.jpg
I assigned each scripts to each empty game objects that represent a hour hand, a minute hand, and a second hand, in order to rotate each hand. The scripts make the empty and its children to rotate. Hands consist of planes and materials with texture images.
I put a pseudo code of the script for the hour hand bellow. To minute and second hands, codes should be changed.
code: clock_pseudocode
FOR each frame
CURRENT_TIME = get current time
ANGLE = (360 * (CURRENT_TIME.Hour % 12) / 12)
// if minute or second, ANGLE should be (360*CURRENT_TIME.Minute/60) or (360*CURRENT_TIME.Second/60)
set rotation value of the object to ANGLE
/icons/hr.icon
Model
https://scrapbox.io/files/6155d1147a9f60002181b12c.jpg
I made the watch model on Blender except for hands. The wireframe above shows ones already applied subdivision or mirror.
#Scripts