objects interacting across frames 
Author Message
 objects interacting across frames

thanks to ya'll for past help.  Here's another question:

I have some button-type objects in my vrml world that activate sounds,
turn objects on/off, ect...   (SEE Code snippet below)  My problem,
however, is that I want most of these buttons to be stationary while the
viewer rotates/translates the main object in the screen;  however, as
things are currently arranged, the buttons likewise twirl all over the
place, along with the model.  I have decided that the best way to handle
this is to put my button objects in a frame of their own;  in doing so,
however, how can link them back to the objects in the main frame?  I
though of using the Anchor node with "parameter 'target=main_frame'",
but 1)it cannot be toggled, that I know of, and 2)the toggled or turned
on object replaces the object already in the frame, rather than simply
add to the frame.

your reponses are eagerly, appreciably awaited,
thanks,
john

------------     SAMPLE BELOW       ----------
# ----- beginning of PROTO "changeSwitch" ----- #
PROTO changeSwitch2 [
     eventIn      SFInt32 setValue2
     eventIn      SFTime  incrementValue2
     eventOut     SFInt32 switchValue2
   ]
{
  Script {
    eventIn      SFInt32 setValue2 IS setValue2
    eventIn      SFTime  incrementValue2 IS incrementValue2
    eventOut     SFInt32 switchValue2 IS switchValue2
    url "vrmlscript:
     function setValue2(value2) {
  switchValue2 = value2;
  if (switchValue2 < 0)
      switchValue2 = 0;
  if (switchValue2 > 2)
      switchValue2 = 2; }
     function incrementValue2(value2) {
  switchValue2++;
  if (switchValue2 > 2)
      switchValue2 = 0; }"
 }

Quote:
}

# --------------------------------------------- #
# ----- beginning of "changeScene" ----- #
    DEF changeScene2 Script {
      eventIn      SFInt32 setScene2
      eventIn      SFTime nextScene2
      eventOut     SFInt32 sceneNo2
      eventOut     SFInt32 elpaso2
      url "vrmlscript:
 function setScene2(value2) {
     sceneNo2 = value2;
     if (sceneNo2 < 1)
  sceneNo2 = 1;
     if (sceneNo2 > 2)
  sceneNo2 = 1;

     if (sceneNo2 == 0)
  elpaso2 = 1;
     if (sceneNo2 == 1)
  elpaso2 = 2;
     if (sceneNo2 == 2)
  elpaso2 = 0;         }

 function nextScene2(value2) {
     sceneNo2++;
     if (sceneNo2 > 2)
  sceneNo2 = 0;
     setScene2(sceneNo2);
 }"
    }
    DEF setElPaso2 changeSwitch2 {    }
# --------------------------------------------- #
# ----- THE DATA
    Group {
     children [
 DEF model_EP2 Switch {
   whichChoice 0
   choice [
          Group {  # ----  opens here;  never comes back
            children [
       Inline { url "data/top_x2k.wrl" }
            Inline { url "data/ind2.wrl" }
            ]}
     Inline { url "data/nothing.wrl" }
   ]
 }
# --------------------------------------------- #
# ----- BOX
 Transform {
   children [
     Shape {
       appearance USE {*filter*}
       geometry Box {size 900 1 300}
     }
     DEF Touch1_122 TouchSensor {}
   ]
   translation 217900 1123010 15880
 }
     ]

Quote:
}

ROUTE Touch1_122.touchTime TO changeScene2.nextScene2
ROUTE changeScene2.elpaso2 TO setElPaso2.setValue2
ROUTE setElPaso2.switchValue2 TO model_EP2.set_whichChoice


Sun, 17 Nov 2002 03:00:00 GMT  
 objects interacting across frames

Quote:

>I have some button-type objects in my VRML world that activate sounds,
>turn objects on/off, ect...   (SEE Code snippet below)  My problem,
>however, is that I want most of these buttons to be stationary while the
>viewer rotates/translates the main object in the screen;  however, as
>things are currently arranged, the buttons likewise twirl all over the
>place, along with the model.
> I have decided that the best way to handle
>this is to put my button objects in a frame of their own

that makes your problem too complicated,
what you need is a 'HUD' a "Heads Up Display"-code for your GUI items:

Collision {collide FALSE children [
  DEF gui1 Transform {children [
       # place your user interface geometry nodes here,
       # and take care that they are positioned well in your first viewpoint
       # then they will move with you, during all viewpoint changes
  ]}
]}

DEF PS ProximitySensor { size 1e25 1e25 1e25 }    # if that's big enough :-)

ROUTE PS.position_changed TO gui.translation
ROUTE PS.orientation_changed TO gui.rotation



Sun, 17 Nov 2002 03:00:00 GMT  
 objects interacting across frames

Hi,

You should try using a HUD (Heads up display). You need to put all of your
objects in a
transform and route the position and orientation of a ProximitySensor to
that transform.
You may need to put the objects in a collision node, with collision off,
depending on the
type and location of objects in the HUD.

I have a few examples at my site:
The E Cubed VRML Experience.
Try my IndexedFaceSet world under my "VRML Help" box.  Also, I use it in my
'Spy'
world, and in my 'Firing Range' world.

Good luck,
Ernest Rose

Quote:

> thanks to ya'll for past help.  Here's another question:

> I have some button-type objects in my VRML world that activate sounds,
> turn objects on/off, ect...   (SEE Code snippet below)  My problem,
> however, is that I want most of these buttons to be stationary while the
> viewer rotates/translates the main object in the screen;  however, as
> things are currently arranged, the buttons likewise twirl all over the
> place, along with the model.  I have decided that the best way to handle
> this is to put my button objects in a frame of their own;  in doing so,
> however, how can link them back to the objects in the main frame?  I
> though of using the Anchor node with "parameter 'target=main_frame'",
> but 1)it cannot be toggled, that I know of, and 2)the toggled or turned
> on object replaces the object already in the frame, rather than simply
> add to the frame.

> your reponses are eagerly, appreciably awaited,
> thanks,
> john

> ------------     SAMPLE BELOW       ----------
> # ----- beginning of PROTO "changeSwitch" ----- #
> PROTO changeSwitch2 [
>      eventIn      SFInt32 setValue2
>      eventIn      SFTime  incrementValue2
>      eventOut     SFInt32 switchValue2
>    ]
> {
>   Script {
>     eventIn      SFInt32 setValue2 IS setValue2
>     eventIn      SFTime  incrementValue2 IS incrementValue2
>     eventOut     SFInt32 switchValue2 IS switchValue2
>     url "vrmlscript:
>      function setValue2(value2) {
>   switchValue2 = value2;
>   if (switchValue2 < 0)
>       switchValue2 = 0;
>   if (switchValue2 > 2)
>       switchValue2 = 2; }
>      function incrementValue2(value2) {
>   switchValue2++;
>   if (switchValue2 > 2)
>       switchValue2 = 0; }"
>  }
> }
> # --------------------------------------------- #
> # ----- beginning of "changeScene" ----- #
>     DEF changeScene2 Script {
>       eventIn      SFInt32 setScene2
>       eventIn      SFTime nextScene2
>       eventOut     SFInt32 sceneNo2
>       eventOut     SFInt32 elpaso2
>       url "vrmlscript:
>  function setScene2(value2) {
>      sceneNo2 = value2;
>      if (sceneNo2 < 1)
>   sceneNo2 = 1;
>      if (sceneNo2 > 2)
>   sceneNo2 = 1;

>      if (sceneNo2 == 0)
>   elpaso2 = 1;
>      if (sceneNo2 == 1)
>   elpaso2 = 2;
>      if (sceneNo2 == 2)
>   elpaso2 = 0;         }

>  function nextScene2(value2) {
>      sceneNo2++;
>      if (sceneNo2 > 2)
>   sceneNo2 = 0;
>      setScene2(sceneNo2);
>  }"
>     }
>     DEF setElPaso2 changeSwitch2 {    }
> # --------------------------------------------- #
> # ----- THE DATA
>     Group {
>      children [
>  DEF model_EP2 Switch {
>    whichChoice 0
>    choice [
>           Group {  # ----  opens here;  never comes back
>             children [
>        Inline { url "data/top_x2k.wrl" }
>             Inline { url "data/ind2.wrl" }
>             ]}
>      Inline { url "data/nothing.wrl" }
>    ]
>  }
> # --------------------------------------------- #
> # ----- BOX
>  Transform {
>    children [
>      Shape {
>        appearance USE {*filter*}
>        geometry Box {size 900 1 300}
>      }
>      DEF Touch1_122 TouchSensor {}
>    ]
>    translation 217900 1123010 15880
>  }
>      ]
> }

> ROUTE Touch1_122.touchTime TO changeScene2.nextScene2
> ROUTE changeScene2.elpaso2 TO setElPaso2.setValue2
> ROUTE setElPaso2.switchValue2 TO model_EP2.set_whichChoice



Mon, 18 Nov 2002 03:00:00 GMT  
 objects interacting across frames
John,
Have you tried making your target object a child of a sphere sensor?

have some button-type objects in my VRML world that activate sounds,

Quote:
>turn objects on/off, ect...   (SEE Code snippet below)  My problem,
>however, is that I want most of these buttons to be stationary while the
>viewer rotates/translates the main object in the screen;  however, as
>things are currently arranged, the buttons likewise twirl all over the
>place, along with the model.  I have decided that the best way to handle
>this is to put my button objects in a frame of their own;  in doing so,
>however, how can link them back to the objects in the main frame?  I
>though of using the Anchor node with "parameter 'target=main_frame'",
>but 1)it cannot be toggled, that I know of, and 2)the toggled or turned
>on object replaces the object already in the frame, rather than simply
>add to the frame.

>your reponses are eagerly, appreciably awaited,
>thanks,
>john



Sun, 24 Nov 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Moving Distributed Objects Across the Wire

2. Maintain fsockopen handle, within object, across a session?

3. (LONG) RemoteCall - Calling python objects across sockets

4. Want to interact to a WRL object from a web page

5. Interacting with VRML objects

6. Makig object interact.

7. interacting objects

8. program object-oriented data representation with frames

9. Frames vs. objects

10. frames instead of objects!

11. making objects invisible within a frame?

12. Object and frame languages wanted

 

 
Powered by phpBB® Forum Software