ParallelGraphics Forums
Authoring Tools
You are here: [Forums]::[Authoring Tools]

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:
  Authoring Tools

Subject: viewpoint animating problem, pls have a look
Sender: anear39@hotmail.com 25.05.02 10:07

I have a problem to view the animation effect in
Cortona+NS of the following code, which has two
Signposts, when the user click STOP1 within some
proximity, it guides the viewpoint to STOP2. But it
doesn't work. any comments are apprieciated.
Thanks a lot.
--U.

#VRML V2.0 utf8

PROTO Signpost []
{
Shape { geometry Box {} }
}

PROTO TourStop [
field SFString description "Stop"
field SFVec3f signLocation 0 0 0
eventIn SFVec3f viewpointLocation
eventIn SFRotation viewpointOrientation
eventIn SFBool set_bind
eventOut SFTime touchTime
eventOut SFVec3f position_changed
eventOut SFRotation orientation_changed
eventOut SFBool isInRange
]
{
Transform {
translation IS signLocation
children [
TouchSensor { touchTime IS touchTime }
Signpost {}
]
}
ProximitySensor {
size 100 100 100
position_changed IS position_changed
orientation_changed IS orientation_changed
isActive IS isInRange
center IS signLocation
}
Viewpoint {
description IS description
set_bind IS set_bind
position IS viewpointLocation
orientation IS viewpointOrientation
jump FALSE
    fieldOfView    1.8
}
}

PROTO TourAnimator [
eventIn SFVec3f set_position
eventIn SFRotation set_orientation
eventIn SFTime touchTime
eventIn SFBool set_inRange
eventIn SFBool set_animating
field SFNode orientInterp OrientationInterpolator
{}
field SFNode posInterp PositionInterpolator {}
eventOut SFBool isBound
eventOut SFTime startTime
eventOut SFVec3f position_changed
eventOut SFRotation orientation_changed
]
{
Script {
eventIn SFVec3f set_position IS set_position
field SFVec3f position 0 0 0
eventIn SFRotation set_orientation IS
set_orientation
field SFRotation orientation 0 0 1 0
eventIn SFTime touchTime IS touchTime
field SFBool inRange FALSE
eventIn SFBool set_inRange IS set_inRange
field SFNode orientInterp IS orientInterp
field SFNode posInterp IS posInterp
eventIn SFBool set_animating IS set_animating
eventOut SFBool isBound IS isBound
eventOut SFTime startTime IS startTime
eventOut SFVec3f position_changed IS
position_changed
eventOut SFRotation orientation_changed IS
orientation_changed
directOutput TRUE
url [
"javascript:
function set_position (newPos) {
position = newPos;
}
function set_orientation (newOri) {
orientation = newOri;
}
function touchTime (timeVal) {
if (inRange) {
position_changed = position;
orientation_changed = orientation;
isBound = true;
posInterp.keyValue[0]= position;
orientInterp.keyValue[0] = orientation;
startTime= timeVal;
}
}
function set_inRange (isClose) {
inRange = isClose;
}
function set_animating (isAnimating) {
if (!isAnimating)
isBound= false;
}"
]
}
}

DEF STOP1 TourStop {
description "stop1"
viewpointLocation 10 3 12
viewpointOrientation 0 1 0 1.57
signLocation 11 4 11
}
DEF STOP2 TourStop {
description "stop2"
viewpointLocation 50 5 82
viewpointOrientation 0 1 0 3.14
signLocation 50.5 5 81.5
}
DEF TIMER TimeSensor { cycleInterval 10 }
DEF TRANSLATOR1 PositionInterpolator {
key [0,0.1, 1]
keyValue [0 0 0, 10 3 12, 50 5 82]
}
DEF ROTATOR1 OrientationInterpolator {
key [0,0.1, 1]
keyValue [0 1 0 0, 0 1 0 1.57, 0 1 0 3.14 ]
}
DEF SCRIPT TourAnimator {
orientInterp USE ROTATOR1
posInterp USE TRANSLATOR1
}

ROUTE STOP1.position_changed TO
SCRIPT.set_position
ROUTE STOP1.orientation_changed TO
SCRIPT.set_orientation
ROUTE STOP1.touchTime TO SCRIPT.touchTime
ROUTE STOP1.isInRange TO SCRIPT.set_inRange
ROUTE SCRIPT.position_changed TO
STOP1.viewpointLocation
ROUTE SCRIPT.orientation_changed TO
STOP1.viewpointOrientation
ROUTE SCRIPT.isBound TO STOP1.set_bind
ROUTE SCRIPT.startTime TO TIMER.startTime
ROUTE TIMER.fraction_changed TO
TRANSLATOR1.set_fraction
ROUTE TIMER.fraction_changed TO
ROTATOR1.set_fraction
ROUTE TIMER.isActive TO SCRIPT.set_animating
ROUTE TRANSLATOR1.value_changed TO
STOP1.viewpointLocation
ROUTE ROTATOR1.value_changed TO
STOP1.viewpointOrientation

 


viewpoint animating problem, pls have a look / anear39@hotmail.com / 25.05.02 10:07

Messages in thread: 1


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