This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > February 2004 > door PROTO





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 door PROTO
Andrew Neiderer

2004-02-25, 11:31 am

Is anyone aware of an existing prototype for aperatures ?

For example I would like VRML/X3D code for opening and closing
doors or windows. I would like to have sensor nodes defined
for using doorknobs as well. And audio would be nice.

I know this is asking for a lot but it would be nice to use/add to
existing VRML before starting from scratch.

Any pointers (URLs) are appreciated.

Thank you.

- Andrew M. Neiderer
US ARL
boris

2004-02-25, 1:29 pm


"Andrew Neiderer " <neiderer@morticia.arl.army.mil> wrote in message
news:HtnACB.6ty@arl.army.mil...
> Is anyone aware of an existing prototype for aperatures ?
>
> For example I would like VRML/X3D code for opening and closing
> doors or windows. I would like to have sensor nodes defined
> for using doorknobs as well. And audio would be nice.
>
> I know this is asking for a lot but it would be nice to use/add to
> existing VRML before starting from scratch.
>
> Any pointers (URLs) are appreciated.
>
> Thank you.
>
> - Andrew M. Neiderer
> US ARL


It was posted here not long ago. Here you are, for a double door, suitable
for windows, too.

There is reference on audio file as well, and there is no knob, touch sensor
responds on the door itself.

#VRML V2.0 utf8

PROTO dDOOR [
exposedField SFVec3f door_pos 0 0 0
exposedField MFString doorTexture ["doorwood.jpg"] ]{

DEF DOOR Transform {
translation IS door_pos
children [
DEF prox ProximitySensor {
center 0 0 0
size 5 3 10
}
DEF DOOR_1 Transform {
translation 0.9 -1.2 0
children [
Shape {
appearance Appearance {texture ImageTexture { url IS
doorTexture }
textureTransform TextureTransform{}
material Material {
diffuseColor 0.5255 0.02353 0.02353
}
}
geometry DEF DOOR_1-FACES IndexedFaceSet {
ccw TRUE
solid TRUE
convex TRUE
coord DEF DOOR_1-COORD Coordinate { point [
0.0 0 0.03, 0.0 0 -0.03, -0.90 0 -0.03, -0.90 0 0.03,
0.0 2.4 0.03, 0.0 2.4 -0.03, -0.90 2.4 -0.03,
-0.90 2.4 0.03]
}
coordIndex [
0, 1, 5, 4, -1, 1, 2, 6, 5, -1, 2, 3, 7, 6, -1, 3,
0, 4, 7, -1, 0, 3, 2, 1, -1, 6, 7, 4, 5, -1]
}
}
]
},
DEF DOOR_2 Transform {
translation -0.9 -1.2 0
children [
Shape {
appearance Appearance {texture ImageTexture { url IS
doorTexture }
textureTransform TextureTransform{}
material Material {
diffuseColor 0.5255 0.02353 0.02353
}
}
geometry DEF DOOR_2-FACES IndexedFaceSet {
ccw TRUE
solid TRUE
convex TRUE
coord DEF DOOR_2-COORD Coordinate { point [
0.90 0 0.03, 0.90 0 -0.03, 0 0 -0.03, 0 0 0.03,
0.90 2.4 0.03, 0.90 2.4 -0.03, 0 2.4 -0.03,
0 2.4 0.03]
}
coordIndex [
0, 1, 5, 4, -1, 1, 2, 6, 5, -1, 2, 3, 7, 6, -1, 3,
0, 4, 7, -1, 0, 3, 2, 1, -1, 6, 7, 4, 5, -1]
}
}
]
},
Sound { source DEF Source AudioClip {
url "door3.wav"
loop FALSE
}
} DEF Sensor TouchSensor {enabled FALSE
}
]
}

DEF openDoor TimeSensor {
cycleInterval 2
startTime -1
}
DEF open1 OrientationInterpolator {
key [
0 1
]
keyValue [
0.0 1.0 0.0 0.0
0 1.0 0 1.571
]
}
DEF close1 OrientationInterpolator {
key [
0 1
]
keyValue [
0 1 0 1.571
0.0 1.0 0.0 0.0
]
}
DEF closeDoor TimeSensor {
cycleInterval 2
startTime -1
}
DEF open2 OrientationInterpolator {
key [
0 1
]
keyValue [
0.0 1.0 0.0 0.0
0 1.0 0 -1.571
]
}
DEF close2 OrientationInterpolator {
key [
0 1
]
keyValue [
0 1 0 -1.571
0.0 1.0 0.0 0.0
]
}
DEF ToggleDoor Script {
field SFBool state FALSE
eventIn SFTime toggle
eventOut SFTime startClose
eventOut SFTime startOpen
url "vrmlscript:
function toggle(curtime) {
state = !state;
if (state) {
startOpen = curtime;
startClose = -1;
}
else
{
startOpen = -1;
startClose = curtime;
}
}"
}

ROUTE prox.isActive TO Sensor.enabled
ROUTE Sensor.touchTime TO ToggleDoor.toggle
ROUTE ToggleDoor.startClose TO closeDoor.startTime
ROUTE ToggleDoor.startOpen TO openDoor.startTime
ROUTE openDoor.fraction_changed TO open1.set_fraction
ROUTE open1.value_changed TO DOOR_1.set_rotation
ROUTE closeDoor.fraction_changed TO close1.set_fraction
ROUTE close1.value_changed TO DOOR_1.set_rotation
ROUTE openDoor.fraction_changed TO open2.set_fraction
ROUTE open2.value_changed TO DOOR_2.set_rotation
ROUTE closeDoor.fraction_changed TO close2.set_fraction
ROUTE close2.value_changed TO DOOR_2.set_rotation
ROUTE Sensor.touchTime TO Source.set_startTime
}
dDOOR { }


M.Starzykowski

2004-02-28, 5:28 am

Hi
Look at 3D world at
http://www.vrml.enter.net.pl/vr_lokalne/index.wrl
its a World Of Hex, for simply presentations some
vrml features.

There is a very good door PROTO, working on ProximitySensor
and Script. Working at cortona/cosmoPlayer , doesnt work
on Blaxxun (trouble with script interpretation, but I dont
known why).

regards
marcin



Użytkownik Andrew Neiderer napisał:
> Is anyone aware of an existing prototype for aperatures ?
>
> For example I would like VRML/X3D code for opening and closing
> doors or windows. I would like to have sensor nodes defined
> for using doorknobs as well. And audio would be nice.
>
> I know this is asking for a lot but it would be nice to use/add to
> existing VRML before starting from scratch.
>
> Any pointers (URLs) are appreciated.
>
> Thank you.
>
> - Andrew M. Neiderer
> US ARL

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews