Lighthouse3d.com

Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Box
Sphere
Cone
Cylinder
PointSet
IndexedLineSet
IndexedFaceSet
Extrusion
ElevationGrid
Example: Chessboard
Text
FontStyle
Appearance
Material
Textures
Image Texture
Movie Texture
Pixel Texture
Texture Coordinate
Texture Transform
Let there be Light
Directional Light
Point Light
Spot Light
Materials with Colored Lights
Hierarchical Node Structures
Group
Transform
Collision
Anchor
Billboard
Switch
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Creating Paths between events: ROUTE
Generating Events based on Timers or User Actions
Timers
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Interpolators
Color
Coordinate
Normal
Orientation
Position
Scalar
Example
Let the Music Play
Sound
AudioClip
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Background
Fog
Information about your world
WorldInfo
Definition for Auxiliary Nodes
Coordinate
Color
Normal

[r8=y Z 35ɜٓqRbW "Aou=;Ov %R4%QRrhn4@uo?wœ;_ 7k*-x f#(Γ\} ;gx%BssB>d; 2>0F~GL׺z=u< ` Ga.J$b%Ud.8W,yWi$8|)MX>gd,Ex! e~IzB[ݯ0j)Vz=[JT`g-|"S k *3Q4Q:/瘙OuS@nȓ|Lˏ~D֏5_dhBY!tNIViF"j`)m'Nl6Drilct3%zゑ2wuyݻÆwAuylC&1ǝ]*]ޕ WWf=N{\roU{L?Zg-g-'| Ae.#[Oͩ5-u!,g: bPbϏ wlcO|係x['NUO#i${σq;5 נĻe@sOeل9[VAp+*P0BqXJlKHct?`McF <Ła]+y~$> @z1yW'|oS ),J;Q֟'gk<+i2pP|,Py n2$+ŶHUW<צڟT W"Hũ1;h&RʧwON/L` l+RBH6/ :}Vla> ͳ~=RmemVe'Ҫho,bRiӶدay]x50z#1DkEM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Cg=cXW/u蔕0Ri3x;5l2Ӊ?Of0< }5HL ݉pW=›A?aTIpoRMIb)s &Om,B{Za 26Q%b­;`|| G~0o&2YiX'\>Vzd/W]ghm^|$PۧO?qLx{q?nSw=n{dr;x[owGgDq{p< h qYzT"{Dҽli7O={G)ˉ

ProximitySensor Example


Many people have asked how to have a shape, or group of shapes, keeping its relative position to the user when the user is moving. This example shows you how to do that.

ProximitySensor nodes can be used to keep track of the users position and orientation. Two eventOuts are provided for this effect:
  • position_changed
  • orientation_changed
  • Therefore a ProximitySensor node generates events whenever the user changes its position or orientation. These events can then be routed to a Transform node where the shapes are placed.

    The only problem with this method is that a ProximitySensor requires the definition of the size of a virtual box. If the user is outside the virtual box then the ProximitySensor will NOT generate events. To avoid this problem one can always define the size of the ProximitySensor to be larger than the world itself.

    The following code should do the trick:



    Example:
    #VRML V2.0 utf8

    Group {
      children [
        DEF ps ProximitySensor {
          center 0 0 0

          size 1000 1000 1000
        }

        DEF tr Transform {
          children
            Transform {
              translation 0 0 -5

              children

              Shape {geometry Sphere{}}
            }
        }
      ]
    }

    ROUTE ps.position_changed TO tr.set_translation

    ROUTE ps.orientation_changed TO tr.set_rotation


    Note that the sphere which is 'locked' to the user position is inside a Transform node which contains a translation. This translation defines the relative position to the user, in this case the center of the sphere will be 5 units away from the user.

    Press the button below to see the VRML. Note that there is also a box in the world. The box should remain in its position while you move, only the sphere will follow your movement.