Skip to content

Commit 945192b

Browse files
committed
add minute hand and get hands to spin at the right relative rate
1 parent 70014ee commit 945192b

File tree

1 file changed

+13
-1
lines changed
  • basics/game-objects-and-scripts/src

1 file changed

+13
-1
lines changed

basics/game-objects-and-scripts/src/main.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,23 @@ fn draw_model(state: &State, view_proj: Mat4) {
298298
cube!(model)
299299
}
300300

301+
let minute_angle = -state.time * 1./32.;
302+
301303
// Hour hand
302304
{
303305
let model =
304-
Mat4::rotation(Radians(-state.time), vec3!(z)) *
306+
Mat4::rotation(Radians(minute_angle * 60.), vec3!(z)) *
305307
Mat4::translate(vec3!(0., 0.75 * T_K, 0.25 * T_K)) *
308+
Mat4::scale(vec3!(0.2, 4., 0.1));
309+
310+
cube!(model)
311+
}
312+
313+
// Minute hand
314+
{
315+
let model =
316+
Mat4::rotation(Radians(minute_angle), vec3!(z)) *
317+
Mat4::translate(vec3!(0., T_K, 0.35 * T_K)) *
306318
Mat4::scale(vec3!(0.3, 2.5, 0.1));
307319

308320
cube!(model)

0 commit comments

Comments
 (0)