Newton's cradle twist
Recently, there is discussion about pendulum wave effect produced using the Newton's cradle. There are many YouTube videos about pendulum waves. Having seen some of these "amazing" wave effect, I thought that VRMath2 Editor should be able to produce a fake, but good enough to show the effect of pendulum wave simulation. And here you go, see the 3D simulation below.
CLEAN HOME CT RESET SETBG 31 ; black background ; collect orientations TR 40 COLLECTORI "oris REPEAT 4 [ TL 20 ] REPEAT 4 [ TR 20 ] ENDCOLLECT "oris HOME ; create cradle and animation MAKE "start GETTIME/1000 ; get a common startTime for timeSensors SETMAT 4 20 ; neon blue for balls SETPCNAME "white REPEAT 20 [ TRANSFORM MAKE "obj OBJECT RD 90 SETPARENT :obj PD FD 3 PU SETSCALE .5 .5 .5 BALL SETSCALE 1 1 1 SETPARENT "root BK 3 RU 90 MAKE "t 6 - # * .1 ORIENT :obj :oris :t SET WORD "orient_ts_ :obj "startTime :start FD 1 ] ; create a rod on top BK 10.5 SETSCALE .1 20 .1 SETMAT 4 4 ; neon orange for the rod RD 90 CAN RU 90
The real pendulum simulation has gradual decreasing length for each ball to set its swing period. This fake simulation however, can directly set the swing period (i.e., cycleInterval in line 29-30). Another key tricky idea to synchronise the swing of 20 balls is to set the startTime of all the TimeSensors (see line 31).
- Andy's blog
- Login or register to post comments
- 9042 reads