Lecture slides
Download
Report
Transcript Lecture slides
Viewpoint and Animation
Example: Bus
Sensors
DEF BusTimer TimeSensor { cycleInterval 120 loop
FALSE}
DEF BusSensor ProximitySensor {center 0 1.5 0 size 8 3
3}
Proximity Sensor
ProximitySensor {
}
exposedField SFVec3f
center 0 0 0
exposedField SFVec3f
size
exposedField SFBool
enable TRUE
evenOut
SFBool
isActive
eventOut
SFVec3f
position_changed
eventOut
SFRotation
orientation_changed
eventOut
SFTime
enterTime
eventOut
SFTime
exitTime
000
DEF BusPosition PositionInterpolator
{key [ 0, .01, .02, .03, .04, .05, .06, .07, .08, .09,
.10, .11, .12, .13, .14, .15, .16, .17, .18, .19,
.20, .21, .22, .23, .24, .25, .26, .27, .28, .29,
.30, .31, .32, .33, .34, .35, .36, .37, .38, .39,
.40, .41, .42, .43, .44, .45, .46, .47, .48, .49,
.50, .51, .52, .53, .54, .55, .56, .57, .58, .59,
.60, .61, .62, .63, .64, .65, .66, .67, .68, .69,
.70, .71, .72, .73, .74, .75, .76, .77, .78, .79,
.80, .81, .82, .83, .84, .85, .86, .87, .88, .89,
.90, .91, .92, .93, .94, .95, .96, .97, .98, .99, 1.0]
keyValue [ 0 0 -1.5, 8 0 -1.5, 16 0 -1.5, 25 0 -1.5, 32 0 -1.5,
40 0 -1.5, 48 0 -1.5, 56 0 -1.5, 64 0 -1.5, 72 0 -1.5, #.9
80 0 -1.5, 88 0 -1.5, 98.5 0 -1.5, 98.5 0 -9.5, 98.5 0 -17.5, #.12 go north
98.5 0 -25.5, 98.5 0 -33.5, 98.5 0 -41.5, 98.5 0 -45.5, 96 0 -48.5,#.19
96 0 -48.5, 96 0 -48.5, 88 0 -48.5, 78 0 -48.5, 68 0 -48.5, #go west
58 0 -48.5, 48 0 -48.5, 38 0 -48.5, 28 0 -48.5, 18 0 -48.4,#.29
8 0 -48.5, -8 0 -48.5, -18 0 -48.5, -28 0 -48.5, -38 0 -48.5, -48 0 -48.5, -58 0 -48.5, 68 0 -48.5, -78 0 -48.5, -88 0 -48.5, -96 0 -48.5, -96 0 -48.5, -96 0 -48.5, -98.5 0 -40,
-98.5 0 -30, #.43 go south
-98.5 0 -20, -98.5 0 -10, -98.5 0 0, -98.5 0 8, -98.5 0 16, #.49
-98.5 0 24, -98.5 0 32, -98.5 0 48, -98.5 0 48, -98.5 0 48, #.52 go to east
-88 0 48.5, -80 0 48.5, -72 0 48.5, -64 0 48.5, -56 0 48.5,#.59
-48 0 48.5, -40 0 48.5, -32 0 48.5, -24 0 48.5, -16 0 48.5, -8 0 48.5, 6 0 48.5, 14 0
48.5, 24 0 48.5, 34 0 48.5,44 0 48.5, 54 0 48.5, 64 0 48.5, 74 0 48.5, 84 0 48.5, 96 0
48.5, 96 0 48.5, 96 0 48.5, 98.5 0 40, 98.5 0 32, #.79, .78 go north
98.5 0 24, 98.5 0 16, 98.5 0 8, 98.5 0 -1.5, 90 0 -1.5, #.84 go west
80 0 -1.5, 70 0 -1.5, 60 0 -1.5, 50 0 -1.5, 40 0 -1.5, #.89
30 0 -1.5, 20 0 -1.5, 10 0 -1.5, 0 0 -1.5, -8 0 -1.5, #
-8 0 -1.5, -8 0 -1.5, -8 0 -1.5, -8 0 -1.5, -8 0 -1.5, -5 0 -1.5 #1.0
]}
DEF BusRotation OrientationInterpolator
{key [
0, .01, .02, .03, .04, .05, .06, .07, .08, .09,
.10,.11,.12, .13, .14, .15, .16, .17, .18, .19,
.20,.21,.22, .23, .24, .25, .26, .27, .28, .29,
.30, .31, .32, .33, .34, .35, .36, .37, .38, .39,
.40, .41, .42, .43, .44, .45, .46, .46, .47, .48, .49,
.50, .51, .52, .53, .54, .55,.56, .57, .58, .59,
.60, .61, .62, .63, .64, .65, .66, .67, .68, .69,
.70,.71,.72,.73, .74,.75,.76,.77,.78,.79,
.80,.81,.82,.83, .84, .85, .86,.87,.88,.89,
.90,.91,.92,.93,.94, .95, .96, .97, .98, .99, 1.0, 1.01]
keyValue [ 0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0,
0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, #.09
0 1 0 0, 0 1 0 0, 0 1 0 1.5708, 0 1 0 1.5708, 0 1 0 1.5708,
0 1 0 1.5708,0 1 0 1.5708, 0 1 0 1.5708, 0 1 0 1.5708, 0 1 0 3.1416, #.19
0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,
0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,#.29
0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,
0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,#.39
0 1 0 3.1416,0 1 0 3.1416,0 1 0 3.1416,0 1 0 -1.5708,0 1 0 -1.5708,
0 1 0 -1.5708,0 1 0 -1.5708, 0 1 0 -1.5708, 0 1 0 -1.5708, 0 1 0 -1.5708,#.49
0 1 0 -1.5708,0 1 0 -1.5708, 0 1 0 0, 0 1 0 0, 0 1 0 0,
0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, #.59
0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0,
0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0,#.69
0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 0,
0 1 0 0, 0 1 0 0, 0 1 0 0, 0 1 0 1.5708, 0 1 0 1.5708, #.79
0 1 0 1.5708, 0 1 0 1.5708, 0 1 0 1.5708, 0 1 0 1.5708, 0 1 0 3.1416,
0 1 0 3.1416, 0 1 0 3.1416, 0 1 0 3.1416, 0 1 0 3.1416, 0 1 0 3.1416, #.89
0 1 0 3.1416, 0 1 0 3.1416, 0 1 0 3.1416, 0 1 0 3.1416, 0 1 0 3.1416,
0 1 0 2.4, 0 1 0 1.5708, 0 1 0 1, 0 1 0 .5, 0 1 0 0, 0 1 0 0, 0 1 0 0 # bus turns around
]}
ROUTE BusSensor.enterTime TO BusTimer.startTime
ROUTE BusTimer.fraction_changed TO BusPosition.set_fraction
ROUTE BusTimer.fraction_changed TO BusRotation.set_fraction
ROUTE BusPosition.value_changed TO bus1.set_position
ROUTE BusRotation.value_changed TO bus1.set_rotation
Proximity
Sensor
Time
Sensor
Position
Interpolator
Bus
Position
Rotation
Bus
Interpolator
Rotation
ViewPoint
Viewpoint {
eventIn
SFBool
set_bind
exposedField
SFFloat
fieldOfView 0.78398
exposedField
SFBool
jump TRUE
exposedField
SFRotation
orientation 0 0 1 0
exposedField
SFVec3f
position 0 0 10
field
SFString
“”
eventOut
SFTime
bindTime
eventOut
SFBool
isBound
ROUTE BusPosition.value_changed TO viewpoint.set_position
ROUTE BusRotation.value_changed TO viewpoint.set_orientation
PROTO viewpoint [ exposedField SFVec3f position 0 0 0
exposedField SFRotation orientation 0 0 1 0]
{ Transform {translation 0 1.5 0
children Viewpoint { position IS position
orientation IS orientation } } }