vrml实例源代码(摆球、风扇、书柜代码)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1.会动的摆球
#VRML V2.0 utf8
Background {skyColor .6 .6 1}
Transform {translation 0 -2.5 0
children [Shape {appearance Appearance {
material Material{diffuseColor 0 1 1} }
geometry Box {size 10 1 1}}
]}
Transform {translation 4 0 0
children [Shape {appearance
Appearance{
material Material {diffuseColor 1 0 1}
}geometry Box {size 0.5 5.8 0.6}} ]} Transform {translation -4 0 0
children [Shape {appearance
Appearance{
material Material {diffuseColor 1 0 1}
}geometry Box {size 0.5 5.8 0.6}} ]}
Transform {translation 0 2.5 0
rotation 0 0 1 1.571
children [Shape {
appearance Appearance {material Material {
diffuseColor .5 0 1}}
geometry Cylinder {radius 0.2 height 7.5}}]}
DEF hk Transform {
children [Group {children [
Transform {translation 0 -1.42 0
children [Shape {appearance
Appearance {
material Material {diffuseColor 2 1 1}}
geometry Sphere {radius
0.3}
}]}
Transform {translation 0 0.6 0
children [Shape {appearance Appearance {
material Material {diffuseColor 0 .8 1}}
geometry Cylinder {radius 0.1 height 3.5}
}]}
]}
]}
DEF left Transform {
translation -1.2 0 0
center 0 2.35 0
children [USE hk ]}
Transform {
translation 0.6 0 0
rotation 0 0 1 0
children [USE hk ]}
Transform {
translation -.6 0 0
rotation 0 0 1 0
children [USE hk ]}
DEF right Transform {
translation 1.2 0 0
center 0 2.35 0
children [USE hk ]}
DEF time TimeSensor {
cycleInterval 1
loop TRUE enabled TRUE }
DEF z1 OrientationInterpolator {
key [0 0.25 0.5 0.75 1]
keyValue [
0 0 1 0,
0 0 1 0.5,
0 0 1 0,
0 0 1 0,
0 0 1 0,]}
DEF z2 OrientationInterpolator {
key [0 0.25 0.5 0.75 1]
keyValue [
0 0 1 0,
0 0 1 0,
0 0 1 0,
0 0 1 -0.5,
0 0 1 0,]}
ROUTE time.fraction_changed TO z1.set_fraction
ROUTE time.fraction_changed TO z2.set_fraction
ROUTE z1.value_changed TO right.rotation
ROUTE z2.value_changed TO left.rotation
2.不用电的电风扇
#VRML V2.0 utf8
Background {skyColor [1 1 0.9]}
DEF a Transform {
translation 0 1.3 -0.2
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 1 1 1}}
geometry Sphere {radius
0.2}}
Transform {translation 1 0 0
scale 0.9 0.3 0.1
center -1 0 0
rotation 0 0 1 0
children [
Shape { appearance Appearance {
material Material {
diffuseColor 0 0 1}}
geometry Sphere {radius 1}}]}
Transform {translation 1 0 0
scale 0.9 0.3 0.1
center -1 0 0
rotation 0 0 1 2.094
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0 1 0}}
geometry Sphere {radius 1}}]}
Transform {translation 1 0 0