
Next, build a VRML scene. For this tutorial, we'll use this simple VRML scene:
Separator
{
DEF Cube_transform Transform { rotation 0 1 0 0 }
Cube { }
}
To see this effect, save the VRML file, put it on a World-Wide Web server, and
configure your room to point to the file's URL. (In GozenMUSH, you would do:
'&vrml_url here=http://www.chaco.com/~vrmldemo/demo1.wrl').
Then, leave your demo room and re-enter it. Be sure the cube is visible. To
rotate the cube, you can do this:
To make the cube rotate on its own, you could use this TinyMUSH code:
@lock cube rotator==me
drop cube rotator
&spin cube rotator=$spin:@dolist [lnum(32)]=@wait ##=@emit/noreturn <img
xch_graph="event Cube_transform SFRotation set_rotation 0 1 0 [mul(0.1,##)] ">
One drawback of this method of animation is that there is no synchronization
between the World and the client. Here is another version of the Cube Rotator
that synchronizes using <img xch_cmd> to force the client command to execute a
command which causes the next <img xch_graph=event> rotation to be sent:
@lock Rotation==me
&ROTATE Rotation=&angle_%0 me=[add(v(angle_%0),v(angle_inc))];@pemit/noreturn
%0=<img xch_graph="event Cube_transform SFRotation set_rotation 0 1 0
[v(angle_%0)] "><img xch_cmd="rotate">
&RO Rotation=$rotate:@trig me/rotate=%#
&ANGLE_INC Rotation=-.1
Building TinyMUSH VRML animations