456 |
DEF Ball Transform {
children [
Shape {
appearance Appearance {
material Material {
ambientIntensity 0.5
diffuseColor 1.0 1.0 1.0
specularColor 0.7 0.7 0.7
shininess 0.4
}
texture ImageTexture { url "beach.jpg" }
textureTransform TextureTransform { scale 2.0 1.0 }
}
geometry Sphere { }
}
]
}
DEF Clock TimeSensor {
cycleInterval 2.0
startTime 1.0
stopTime 0.0
loop TRUE
}
DEF Bouncer Script {
field SFFloat bounceHeight 3.0
eventIn SFFloat set_fraction
eventOut SFVec3f value_changed
url "bounce2.class"
}
ROUTE Clock.fraction_changed TO Bouncer.set_fraction
ROUTE Bouncer.value_changed TO Ball.set_translation