This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > VRML > October 2004 > VRML - open and shut door?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
VRML - open and shut door?
|
|
| Ruth Aylett 2004-10-13, 12:14 pm |
| I have been trying to think how to set up a door in VRML so that one click
on it opens it and the next click closes it. Can't see how to do this as
it seems to require attaching two different animations to one sensor. What
am I missing here?
Ruth
----
| |
| marcin 2004-10-13, 7:15 pm |
| > I have been trying to think how to set up a door in VRML so that one click
> on it opens it and the next click closes it. Can't see how to do this as
> it seems to require attaching two different animations to one sensor. What
> am I missing here?
>
> Ruth
> ----
Hello
Try this code.There is a Script for switching beetween ()Interpolators
and clock. This Script including deleay which give time for full open
or full close door.
DEF door Transform {
children
[
#put here eleents which should be animated
DEF open_lock TouchSensor {enabled TRUE}
]}
#______________________
DEF DoorOpenRotate PositionInterpolator { #you can alo use
#OrientationInterpolator
key [ 0 ,0.5, 1 , ]
keyValue [ 0 0.02 0 , 0 0.04 0 , 0 0.04 -0.45, ]
}
DEF DoorCloseRotate PositionInterpolator {
key [ 0 ,0.5 ,1 , ]
keyValue [0 0.04 -0.45,0 0.04 0 ,0 0.02 0 , ]
}
DEF DoorOpenTimer TimeSensor {
cycleInterval 1
loop FALSE
}
DEF DoorCloseTimer TimeSensor {
cycleInterval 1
loop FALSE
}
DEF DoorOpenClose Script {
eventOut SFTime closeStart
field SFTime delay 1 #this is time
#for full open or full close door
directOutput FALSE
field SFInt32 mode 0
mustEvaluate FALSE
eventOut SFTime openStart
field SFTime time 0
eventIn SFTime touched
url [ "vrmlscript:
function touched (value)
{
if (value >= (time+delay))
{
time=value+.5;
mode=mode+1;
if (mode==1)
{
openStart=value;
}
if (mode==2)
{
closeStart=value;
mode=0;
}
}
}
" ]
}
ROUTE open_lock.touchTime TO DoorOpenClose.touched
ROUTE DoorOpenClose.openStart TO DoorOpenTimer.set_startTime
ROUTE DoorOpenTimer.fraction_changed TO DoorOpenRotate.set_fraction
ROUTE DoorOpenRotate.value_changed TO door.set_translation #zmian
ROUTE DoorOpenClose.closeStart TO DoorCloseTimer.set_startTime
ROUTE DoorCloseTimer.fraction_changed TO DoorCloseRotate.set_fraction
ROUTE DoorCloseRotate.value_changed TO door.set_translation #zmiana
#EOF
--
Pozdrawiam
Marcin Starzykowski
_____________________________________________
www.vrml.enter.net.pl
Ostatnia aktualizacja 01.09.2004
Last update 01.09.2004
_____________________________________________
| |
| Robert Lipman 2004-10-13, 7:15 pm |
| Ruth Aylett wrote:
> I have been trying to think how to set up a door in VRML so that one click
> on it opens it and the next click closes it. Can't see how to do this as
> it seems to require attaching two different animations to one sensor. What
> am I missing here?
I have that type of door at http://cic.nist.gov/vrml/vcbtsim.html There is a
link to the VRML code for the door and other objects.
---
Bob Lipman
http://cic.nist.gov/lipman/
| |
|
|
| simon 2004-10-13, 11:14 pm |
| r.s.aylett@no-spam.salford.ac.uk (Ruth Aylett) wrote in message news:<r.s.aylett-1310041010560001@moria.iti.salford.ac.uk>...
> I have been trying to think how to set up a door in VRML so that one click
> on it opens it and the next click closes it. Can't see how to do this as
> it seems to require attaching two different animations to one sensor. What
> am I missing here?
>
> Ruth
> ----
yes, i've struggled with this, again recently, IMHO the people who
designed VRML hadn't ever worked in machine control, say PLC or the
like, you can't even invert the boolean type without a script!
when you try to do a really nice door, you have to worry about what
happens when someone clicks the door in mid-open/close, what happens
when someone's standing in the way, do you want the sensor to be
active a long way away, do you want the door to self close or not.
however someone has noticed this type of problem, because x3d has a
set of utilities for these occasions called the "Event Utilities
component"
simon.
| |
|
| r.s.aylett@no-spam.salford.ac.uk (Ruth Aylett) wrote in message news:<r.s.aylett-1310041010560001@moria.iti.salford.ac.uk>...
> I have been trying to think how to set up a door in VRML so that one click
> on it opens it and the next click closes it. Can't see how to do this as
> it seems to require attaching two different animations to one sensor. What
> am I missing here?
>
> Ruth
> ----
yes, i've struggled with this, again recently, IMHO the people who
designed VRML hadn't ever worked in machine control, say PLC or the
like, you can't even invert the boolean type without a script!
when you try to do a really nice door, you have to worry about what
happens when someone clicks the door in mid-open/close, what happens
when someone's standing in the way, do you want the sensor to be
active a long way away, do you want the door to self close or not.
however someone has noticed this type of problem, because x3d has a
set of utilities for these occasions called the "Event Utilities
component"
simon.
| |
|
| Check out my 2001 site for an example of a door that opens and closes,
changing direction as soon as you click on it.
The Discovery ship has the doors you are possibly looking for. The dish
antenna does something slightly different. It stops on one click, then changes
direction on the next click.
If you like this I can post the code.
Alex
--
Remove first h for email.
========================================
2001: A Space Odyssey in Virtual Reality
http://home.earthlink.net/~alprojects/2001/index.html
Tribute to the World Trade Center in 3D
http://home.earthlink.net/~alprojects/wtc/index.html
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|