[x3d-public] start timer at fraction 0 after scene loading

Andreas Plesch andreasplesch at gmail.com
Fri Sep 8 21:02:19 PDT 2023


I think you have it pretty much all correct.

On Fri, Sep 8, 2023 at 9:33 PM Joe D Williams <joedwil at earthlink.net> wrote:
>
> Hi Andreas,
> I really looking at this now. Basically I want a short timer to run for one cycle without controlling much of anything, then start the main scene timer for one cycle.
Correct. The start timer can have really any cycleInterval since we
only use it initially, and then stop it.
> Heavy study, the TimeSensor.
True, and implementing it is hairy.
> And how they work with other time things, like audio and video.
> So, I misunderstood and thought loop must be true to start.
> But yes, when timer not running, enabled true and loop false, a good startTime will have it run for one cycle.
Correct. startTime needs to be smaller than now (wall clock time since
1970), and stopTime larger.
> That is my problem. getting that startTime.
Right, the common source for a startTime is TouchSensor,
ProximitySensor, timeTrigger.
> Now for the trick of sending  cycleTime of starter direct to its stopTime. This certainly stops the start timer.
> First, the cycleTime is sent same as startTime, at the beginning of each cycle.
> So, sending cycleTime to its stopTime stops it (almost) immediately.
It is an interesting event cascade question but many browsers will
probably look at the stopTime only once for each tick/cascade. Eg. it
will take to the next tick to stop.
> For sure the timer should not run past the next tic after receiving the stopTime. The cycleTime, is sent at fraction 0, when the first valueChanged is is ready, So at most, the timer should run for 1 or 2 tics then stop.
Right.
>
> That is not quite what I want. I need the starter time to run through one cycle, then start the main clock, which I only want to run for one cycle, then stop at last frame.
Ok. I think that should work by sending the stopTime rather than the
cycleTime of the starter timer to the main clock's startTime. But keep
in mind that the initial fraction of the starter timer is not
deterministic.
If you need the fraction of the starter timer, just use three timers.
A short starter timer to trigger, a first one cycle timer, and a
second one cycle timer.
>
> Thanks for the examples, I am using it and more to be shown a bit later.

Super. Andreas

>
> -----Original Message-----
> From: Andreas Plesch <andreasplesch at gmail.com>
> Sent: Sep 8, 2023 2:03 PM
> To: Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
> Cc: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: Re: [x3d-public] start timer at fraction 0 after scene loading
>
> Another option may be an official COMMENT statement which cannot be
> stripped out and would standardize arbitrary comments across
> encodings. It would be very similar to a top level [ MetadataString
> name='comment' value='general comment' ] node with a small semantic
> difference (should only refer to the code itself, not its content) but
> clearer and a bit more concise. The statement could appear anywhere
> and is completely ignored by the browser. It sounds like something
> which may have been discussed in the deeper past.
>
> Oftentimes it suffices to choose good DEF names to help with
> readability. In this case the DEF names were provided in the original
> NIST example and were not too helpful. Better names may be 'STARTER'
> for TIME1 and 'TIMER' for TIME2.
>
> Best,
>
> -Andreas
>
> On Fri, Sep 8, 2023 at 3:18 PM Brutzman, Donald (Don) (CIV)
> wrote:
> >
> > Very interesting, thanks for sharing Andreas. We should all be thinking of regularizing some example design patterns like animation.
> >
> >
> >
> > Meanwhile, your example is the kind that makes me think we should have a description field for ROUTE.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Potential alternative approaches for ROUTE comments:
> >
> >
> >
> > Comments? Sure, but sometimes get stripped, and not unambiguously readable by tools.
> > Prototype extension? Too complex and error prone, fuggedaboutit.
> > Metadata nodes? Hmm, we can't make those part of ROUTE statements themselves, not allowed.
> >
> >
> >
> > Maybe some clumsy-but-unambiguous convention like the following already-legal X3D fragment:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Of course simplest future approach would be to give ROUTE a description field. Hmmm, maybe someday.
> >
> >
> >
> > Might deserve a Mantis issue for X3D4.1 if others agree some potential value exists for future consideation.
> >
> >
> >
> > all the best, Don
> >
> > --
> >
> > Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu
> >
> > Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149
> >
> > X3D graphics, virtual worlds, navy robotics https://faculty.nps.edu/brutzman
> >
> >
> >
> > -----Original Message-----
> > From: x3d-public On Behalf Of Andreas Plesch
> > Sent: Thursday, September 7, 2023 1:43 PM
> > To: X3D Graphics public mailing list
> > Subject: Re: [x3d-public] start timer at fraction 0 after scene loading
> >
> >
> >
> > Here is an initial count down after loading the scene using the same autostart method, and a sequencer:
> >
> >
> >
> > https://andreasplesch.github.io/Library/Viewer/dev.html?url=https://gist.githubusercontent.com/andreasplesch/3f7ea30b9860b6399c797c51e3235459/raw/d17f9d2a0a258569ac5a474c36a68208674d535e/countdown.x3d
> >
> >
> >
> > https://create3000.github.io/x_ite/playground/?url=https://gist.githubusercontent.com/andreasplesch/3f7ea30b9860b6399c797c51e3235459/raw/d17f9d2a0a258569ac5a474c36a68208674d535e/countdown.x3d
> >
> >
> >
> > -Andreas
> >
> >
> >
> > On Thu, Sep 7, 2023 at 1:01 AM Andreas Plesch wrote:
> >
> > >
> >
> > > Another method apart from a ProximitySensor to start a timer without
> >
> > > user interaction after scene loading is to use two TimeSensors. The
> >
> > > first has loop=true and its only purpose is to trigger the second by
> >
> > > routing its cycleTime to the startTime of the second TimeSensor. The
> >
> > > first also stops itself by routing its cycleTime to its own stopTime.
> >
> > >
> >
> > > Here is an example modified from the cycleTime NIST example:
> >
> > >
> >
> > > https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Frent
> >
> > > ry.co%2Fx3d-startTimer&data=05%7C01%7Cbrutzman%40nps.edu%7C4b415083034
> >
> > > 641d371e608dbafe335ef%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638
> >
> > > 297162641403741%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2
> >
> > > luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=v3ah%2F2OY7
> >
> > > NVzEwTUIhRhBjG%2BNHdMZoJTbsC3lEnHR1I%3D&reserved=0
> >
> > >
> >
> > > https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fandr
> >
> > > easplesch.github.io%2FLibrary%2FViewer%2Fdev.html%3Furl%3Dhttps%3A%2F%
> >
> > > 2Fgist.githubusercontent.com%2Fandreasplesch%2F3f7ea30b9860b6399c797c5
> >
> > > 1e3235459%2Fraw%2F118d65438f9cfdc152c01fc5a24a8eccec705511%2FstartTime
> >
> > > r.x3d&data=05%7C01%7Cbrutzman%40nps.edu%7C4b415083034641d371e608dbafe3
> >
> > > 35ef%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638297162641403741%7
> >
> > > CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1
> >
> > > haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=m8xOnL%2BHHQy5gXlqLQaec6vBIi
> >
> > > %2BSchjeWtKfYWNDMHw%3D&reserved=0
> >
> > >
> >
> > > --
> >
> > > Andreas Plesch
> >
> > > Waltham, MA 02453
> >
> >
> >
> >
> >
> >
> >
> > --
> >
> > Andreas Plesch
> >
> > Waltham, MA 02453
> >
> >
> >
> > _______________________________________________
> >
> > x3d-public mailing list
> >
> > x3d-public at web3d.org
> >
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>


-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list