ParallelGraphics Forums
General
You are here: [Forums]::[General]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
Try RobinZone!
email:  password:
  General

Subject: Re: Small Problem
Sender: Uh 20.12.07 02:46

#VRML V2.0 utf8

PROTO BouncingBall [
field SFFloat BounceHeight 1.0
field SFFloat BallStartHeight 0.0
field SFColor BallColor 1.0 1.0 1.0
eventOut SFTime touchTime
exposedField SFTime startTime -1.0
]{
DEF Ball Transform{
children [
Shape {
appearance Appearance {
material Material {
diffuseColor IS BallColor
}
}
geometry Sphere {
radius 1.0
}
}
DEF Touch TouchSensor {
touchTime IS touchTime
}
]
}

DEF Clock TimeSensor {
cycleInterval 2.0
startTime IS startTime
stopTime 0.0
loop TRUE

}
DEF Bouncer Script {
field SFFloat BounceHeight IS BounceHeight
field SFFloat BallStartHeight IS BallStartHeight
eventIn SFFloat set_fraction
eventOut SFVec3f value_changed
url "javascript:
function set_fraction( frac, tm ) {
y = (4.0 * BounceHeight * frac * (1.0 - frac) + BallStartHeight);
value_changed[0] = 0.0;
value_changed[1] = y;
value_changed[2] = 0.0;
}"
}
ROUTE Touch.touchTime TO Clock.startTime
ROUTE Clock.fraction_changed TO Bouncer.set_fraction
ROUTE Bouncer.value_changed TO Ball.set_translation
}

Group {
children [
Transform {
translation -6.0 0.0 0.0
children DEF Ball1 BouncingBall {
BallColor 1.0 0.0 0.0
BounceHeight 4.0
BallStartHeight -3.0
}
}
Transform {
translation -3.0 0.0 0.0
children DEF Ball2 BouncingBall {
BallColor 1.0 1.0 0.0
BallStartHeight -3.0
BounceHeight 5.0
}
}
Transform {
translation 0.0 0.0 0.0
children DEF Ball3 BouncingBall {
BallColor 0.0 1.0 0.0
BallStartHeight -3.0
BounceHeight 8.0
}
}
Transform {
translation 3.0 0.0 0.0
children DEF Ball4 BouncingBall {
BallColor 0.5 0.2 0.0
BallStartHeight -3.0
BounceHeight 3.5
}
}
Transform {
translation 6.0 0.0 0.0
children DEF Ball5 BouncingBall {
BallColor 0.0 0.0 1.0
BallStartHeight -3.0
BounceHeight 6.2
}
}
]
}
ROUTE Ball1.startTime TO Ball2.startTime
ROUTE Ball1.startTime TO Ball3.startTime
ROUTE Ball1.startTime TO Ball4.startTime
ROUTE Ball1.startTime TO Ball5.startTime

Click Ball1.

 


Small Problem / tjames221188@hotmail.com / 20.12.07 00:57
     Re: Small Problem / Uh / 20.12.07 02:46
         Re: Small Problem / tjames221188@hotmail.com / 20.12.07 03:00

Messages in thread: 3


© 1998-2007 ParallelGraphics. All rights reserved. Terms of use.