|
Infrared Wind
Gridologist
Join date: 7 Jan 2007
Posts: 662
|
08-21-2007 08:38
I'm cobbling together a simple analog clock. The minute/hour hands are no problem. From the minute hand, can anyone give me a clue for the second hand based on the minute hand? Here's the minute hand: default { state_entry() { llSetTimerEvent(1); } timer() { float now = llGetWallclock(); integer minute = (integer)now / 60; rotation hand_rot = llEuler2Rot(<0, 6 * minute * DEG_TO_RAD, 0>  ; llSetLocalRot(hand_rot); } } Thanks! - Infrared
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
08-21-2007 09:39
Same as the minute hand but use this integer second = (integer)now % 60; rotation hand_rot = llEuler2Rot(<0, 6 * second * DEG_TO_RAD, 0>  ;
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
08-21-2007 09:44
Also, your minutes calculation is incorrect.
It should be:
integer minutes = ((integer)now % 3600) / 60;
|
|
Infrared Wind
Gridologist
Join date: 7 Jan 2007
Posts: 662
|
08-21-2007 10:25
Awesome Talarus - integer second = (integer)now % 60; is all I needed! Works perfect! And I modified the minute hand with your suggestion. * * * This is my hour hand...any comments? It works fine as is. default { state_entry() { llSetTimerEvent(1); } timer() { float now = llGetWallclock(); float minute = (integer)now / 60; float hour = minute / 60; rotation hand_rot = llEuler2Rot(<0, 30 * hour * DEG_TO_RAD, 0>  ; llSetLocalRot(hand_rot); } } Thanks, - Infrared
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
08-21-2007 11:58
integer hour = ((integer)now / 3600) % 12;
Simplified and kept to a 12 hour span.
|
|
Infrared Wind
Gridologist
Join date: 7 Jan 2007
Posts: 662
|
08-21-2007 18:58
Thank you, Talarus!
|
|
Kal Rau
Registered User
Join date: 26 Apr 2007
Posts: 2
|
Complete script
08-22-2007 09:44
First i am sorry about my english,
I am creator and so bad with script, i see on this topic the 3 hands of a clock, i need create 3 prims each with specific hand script in, but i need make a 4th prim with principal clock script is it??? please i make a goog watch and i want put real moviment to.... i can give the clock for helpers!!
Thx!!
"Kal Rau"
|