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

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 - SDK

Subject: Re: TimeSensor
Sender: Uh 14.04.08 01:22

...
I use TimeSensor and PositionInterpolator to make some animation. Now I want to have two buttons:
1. Pause
2. Start

With the first one I want to hold the camera.
With the second one I want to go further from the
"paused" position.

... #VRML V2.0 utf8

DEF main_TS TouchSensor {}
DEF main_TR Transform {
children
Shape {
geometry Cone {}
}
}
DEF main_TIS TimeSensor {
loop TRUE
enabled FALSE
}
DEF main_PI PositionInterpolator {
key [0 .5 1]
keyValue [0 0 0, 0 2 0, 0 0 0]
}
DEF main_SCR Script {
eventIn SFTime go
eventIn SFFloat set_fraction
eventOut SFFloat f
field SFNode main_TIS USE main_TIS
field SFTime prev_ts -1
field SFTime c -1
url "javascript:
function initialize(){
c = main_TIS.cycleInterval;
}
function go(){
main_TIS.enabled = !main_TIS.enabled;
prev_ts = -1;
}
function set_fraction(val,ts){
if (prev_ts > 0) f = (f + (ts - prev_ts) / c) % 1;
prev_ts = ts;
}
"
}
ROUTE main_TS.touchTime TO main_SCR.go
ROUTE main_TIS.fraction_changed TO main_SCR.set_fraction
ROUTE main_SCR.f TO main_PI.set_fraction
ROUTE main_PI.value_changed TO main_TR.translation

 


TimeSensor / mutafchiev@gmx.de / 21.03.08 08:21
     Re: TimeSensor / Uh / 14.04.08 01:22
         Re: TimeSensor / mutafchiev@gmx.de / 14.04.08 21:18

Messages in thread: 3


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