Problem with vrml- and java-time (using EAI) 
Author Message
 Problem with vrml- and java-time (using EAI)

Hello,

I try to start an TimeSensor in a vrml-scene with "startTime":
I have no problems setting the "cycleInterval" of the TimeSensor. I had
recognized that the vrml-scene and java (both communicate via EAI) use
different times. I tried the following code to find out how much:

        public void callback (EventOut eo, double zeitpunkt, Object o) {

            double delta = zeitpunkt -
(((double)(jetzt.getTime().getTime()))/1000);

             System.out.println(
                "EventOutObserver: " + zeitpunkt + ",   Differenz: " +
delta + "s,   "
                 + delta/3600 + "h"
            );
        }

The java-console gives the following message:
        EventOutObserver: 8.88684308103335E8,   Differenz:
610294.4833350182s,   169.52624537083838h
There is an time-difference of around 170 hours, and this difference is
changing constantly of some seconds.

About my code: "jetzt" is an instance of "GregorianCalendar".
"jetzt.getTime()" creates an "Date"-object in java and
"jetzt.getTime().getTime()" gives the time from January 1st, 1970,
00:00:00 GMT  in Milliseconds [JavaTM Platform 1.1.5 Core API
Specification]. vrml also uses this time-definition [VRML97
Specification, ISO/IEC 14772-1:1997].
Both, the vrml-world and the java-applet are in the same html-page. The
both use the same clock in my computer (under Win95).

Who konws: How can I synchronize both (the vrml-scene and the
java-applet)?
or   How can I tell the TimeSensor in vrml that the "startTime" is NOW?

Many thanks,
  Albrecht



Wed, 09 Aug 2000 03:00:00 GMT  
 Problem with vrml- and java-time (using EAI)

Quote:

> There is an time-difference of around 170 hours, and this difference is
> changing constantly of some seconds.

Sounds like you are using Cosmo Player 2.0. One of our otherwise excellent
engineers multiplied when he should have divided, and thus absolute time
is somewhat off from the system clock. This has been fixed in CP2.1
There is an easy workaround, fortunately.

ROUTE to a javascript Script node in your scene from your EAI applet. Then route an eventOut
from the Script to the TimeSensor. All events in VRML are timestamped, so
when your Script node gets an event, take the timestamp from it and route
it to the startTime of the TimeSensor.

Not clear yet? Like so:

DEF S Script {
   eventIn  SFBool trigger
   eventOut SFTime nowIsTheTimeForAllGoodMen
   url "javascript:
        function trigger(t,timestamp) {
            nowIsTheTimeForAllGoodMen = timestamp;        }
   "

Quote:
}

DEF TS TimeSensor {}

ROUTE S.nowIsTheTimeForAllGoodMen TO TS.startTime

--




Thu, 10 Aug 2000 03:00:00 GMT  
 Problem with vrml- and java-time (using EAI)

Hello,

many thanks for Your help; I have copied Your code and made the neccesary changes in the
applet-sourcecode:

--------------- vrml:
DEF Zeitgeber Script {
    eventIn SFBool anfang
    eventOut SFTime zeit
    url "javascript:
        function anfang(t, timestamp) {
            jetzt = timestamp;
        }
    "

Quote:
}

DEF arm1Zeit TimeSensor { }

ROUTE Zeitgeber.zeit TO arm1Zeit.startTime

--------------- java:
Node scriptKnoten = new Node;
EventInSFBool anfang;
...
scriptKnoten = browser.getNode("Zeitgeber");
anfang = (EventInSFBool)scriptKnoten.getEventIn("anfang");

Well, I think it is OK so far, but how does I have to acces the javascript-scriptnode that it
sends the timesignal "zeit"?
I must send a SFBool, doesn't I?
I have tried "anfang.setValue(false);" and "anfang.setValue(true);" but nothing happend. What
does I have to do?

        Albrecht

Jon Logan schrieb:

Quote:
> Sounds like you are using Cosmo Player 2.0. One of our otherwise excellent
> engineers multiplied when he should have divided, and thus absolute time
> is somewhat off from the system clock. This has been fixed in CP2.1
> There is an easy workaround, fortunately.

> ROUTE to a javascript Script node in your scene from your EAI applet. Then route an eventOut
> from the Script to the TimeSensor. All events in VRML are timestamped, so
> when your Script node gets an event, take the timestamp from it and route
> it to the startTime of the TimeSensor.

> Not clear yet? Like so:

> DEF S Script {
>    eventIn  SFBool trigger
>    eventOut SFTime nowIsTheTimeForAllGoodMen
>    url "javascript:
>         function trigger(t,timestamp) {
>             nowIsTheTimeForAllGoodMen = timestamp;        }
>    "
> }

> DEF TS TimeSensor {}

> ROUTE S.nowIsTheTimeForAllGoodMen TO TS.startTime

> --





Fri, 11 Aug 2000 03:00:00 GMT  
 Problem with vrml- and java-time (using EAI)

Sorry everything  is OK. It was my mistake.

Albrecht

Quote:

> Hello,

> many thanks for Your help; I have copied Your code and made the neccesary changes in the
> applet-sourcecode:

> --------------- vrml:
> DEF Zeitgeber Script {
>     eventIn SFBool anfang
>     eventOut SFTime zeit
>     url "javascript:
>         function anfang(t, timestamp) {
>             jetzt = timestamp;
>         }
>     "
> }
> DEF arm1Zeit TimeSensor { }

> ROUTE Zeitgeber.zeit TO arm1Zeit.startTime

> --------------- java:
> Node scriptKnoten = new Node;
> EventInSFBool anfang;
> ...
> scriptKnoten = browser.getNode("Zeitgeber");
> anfang = (EventInSFBool)scriptKnoten.getEventIn("anfang");

> Well, I think it is OK so far, but how does I have to acces the javascript-scriptnode that it
> sends the timesignal "zeit"?
> I must send a SFBool, doesn't I?
> I have tried "anfang.setValue(false);" and "anfang.setValue(true);" but nothing happend. What
> does I have to do?

>         Albrecht

> Jon Logan schrieb:

> > Sounds like you are using Cosmo Player 2.0. One of our otherwise excellent
> > engineers multiplied when he should have divided, and thus absolute time
> > is somewhat off from the system clock. This has been fixed in CP2.1
> > There is an easy workaround, fortunately.

> > ROUTE to a javascript Script node in your scene from your EAI applet. Then route an eventOut
> > from the Script to the TimeSensor. All events in VRML are timestamped, so
> > when your Script node gets an event, take the timestamp from it and route
> > it to the startTime of the TimeSensor.

> > Not clear yet? Like so:

> > DEF S Script {
> >    eventIn  SFBool trigger
> >    eventOut SFTime nowIsTheTimeForAllGoodMen
> >    url "javascript:
> >         function trigger(t,timestamp) {
> >             nowIsTheTimeForAllGoodMen = timestamp;        }
> >    "
> > }

> > DEF TS TimeSensor {}

> > ROUTE S.nowIsTheTimeForAllGoodMen TO TS.startTime

> > --





Sun, 13 Aug 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. from near VRML to REAL VRML : My first EAI / Java / VRML Humanoid Avatar

2. Using VRML and Java EAI

3. Java in frame can't get instance of Java EAI + VRML in another frame

4. EAI version of VRML 2.0 Tic-Tac-Toe game (VRML + Java)

5. VRML EAI problems: Java3d solves many portabilty problems of VRML

6. VRML/EAI and Java

7. getting VRML and Java/EAI to work in Netscape 4.6 (a solution)

8. Where do I get the VRML EAI(API) for java

9. Android Mercenary, Will Fight for Good or Evil ( VRML / Java EAI )

10. VRML+JavaScript+Java&EAI error on NT (but not 95)

11. EAI SFTime from java to vrml

12. HOW2?: Communication EAI - JAVA applet inside VRML file

 

 
Powered by phpBB® Forum Software