Lighthouse3d.com

uW(.JUMLO-O)ͭKLSW(L)ɰU7TWHL(3RRl bJP< 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

}{69`yƖ͗ӱ3cOn'{EBjڔ!~wod%H"ν'[  ƒGt}I.yx9"BiO>x>K 7Iiv+m,Bz֝Q22 Yu$#(J0hd71 r8 <7 Q\C&eA$?1yEu.,NAVh G?Y4`dx?=ޒil26-kt-dFA̹\I{ /C vtSMc9A :98xwK6ftM6*MD3 dן^‚1}C)a1=w8Kwė;4؂_ 9$i.`͑AVܭlLpҐ1&,2IAqւ&w/@o4f˴YH[t0~L)6.dJ e%ݸ[HcOpI0iP%cbnRP?}:&ЁM\kLt"YM(w9cwbSZqhZu=w}컾At900l,;u}YfPwޘF.F% T(t۶1lli<6˰ k8p J 5EGi([.3:vК0 -!P\Q8$4޷z9+vg^g7kE[vJ N3 7K%pi1۫ Z/čW1  }SC tVh~!⿸Ӂ<>/,0tx~< )DEd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!yKwl-AKӓXD1K[Zg Gn[B@ÄX ؗ)ju:\#TЛ|:.wwm̕8dJ}N F ,~i!9!-F0Q|9a_fu[&^ۀUP&°I=&FtR&0t*$^RMV?J)ܻ~|;{_Icx[Gzx1rV8_rFx[[nl¥O BWzNL\N_7 %-„I˻'ώxPz&)m&dFn~{1=WN7:isk鹠ЏބGh Aܦ{@<\oǢ k?SߖaxJk+٤D9~TfZL$Γ'֑9sϖ'}jZKzx-Hm|jPca`EEK9u!Dy׮ztQTD0a ̕>BMFa4qs'>yABa0? OI-S.Sm]gtƅeRaj-N5V巺W0QPYxc1SCs#%E:OZ}_ \.Fwŀq%/]4|') #eA+%hކ!LhD'nQ_$Ӆ/#Xsuaӓ[fA bкG 8lu6 c7.N3Tnka;NEzIͭr>X{^y.Q|7a ֺ:EȩOM2 1>-! *RMA'Ct0؟%/} [L,:g ֜o.%'?G3^`sX="1~vu\r0r.ym"j\FNh1<1M`<&wh]LRo"鴝v]C tl ,ȇ ?$}5HNOwB,lj51gs}$Q \u{6~bQMov&?wƙ.b'O2=H'U:>kMD$/'yӇB-

TouchSensor Node


The TouchSensor node is a way of providing interactivity with the user. This sensor is usually defined in a group and affects all shapes within that group. The sensor reacts when the user has the mouse over and when the user clicks a shape contained in the group.

This node has a single field which specifies if the sensor is enabled or not.

The isOver event is generated with the value TRUE by this node when the field is enabled and the mouse moves from a position where it is not over a shape contained within the group to a position where it is over a shape. A value FALSE is provided by this event when the sensor is enabled and the mouse stops being over a shape within the group.

If the shapes are not visible, i.e. they are hidden by other surfaces, then the touch sensor should not generate the isOver event.

When the mouse is over a shape within the same group as a TouchSensor, then the following events are generated when the mouse moves:
  • hitPoint_changed: Provides the 3D position on the surface of the shape in the TouchSensor's group coordinate system.
  • hitNormal_changed and hitTextCoord_changed: provide respectively the surface normal vector and the texture coordinates of the surface at the hitPoint.
  • When the user presses the mouse button the TouchSensor will also generate the event isActive with the value TRUE when the user clicks the mouse, if over a shape and enabled. When the user releases the mouse button an isActive event is generated with the value FALSE plus the event touchTime with the current time.

    Syntax:
    TouchSensor {
    enabled TRUE
    }


    When defining several TouchSensor inside nested groups, only the lowest sensor will generate events. For instance consider the following excerpt of code:

    Example:
    DEF ga Group {
         children [
    	DEF sa Shape ...
    	DEF ta TouchSensor {}
    	DEF gb Group {
    		children [
    			DEF sb Shape ...
    			DEF tb TouchSensor {}
    		]
    	}
         ]
    }
    


    When the user clicks over Shape sa, then TouchSensor ta will generate events, when the user clicks on Shape sb only the TouchSensor tb will generate events.

    Example of a TouchSensor to play a sound:

    The following source code describes a group with a Shape, a TouchSensor, and a Sound.

    Example:
    	
    #VRML V2.0 utf8
    
    Group {
          children [
    	DEF ts TouchSensor { }
    	Sound { 
    	     source DEF ac AudioClip { 
    	                      loop FALSE 
    	                      url "sfx.mid"
    	   } 
    	}
    	Shape { 
    	      appearance Appearance { 
    	          material Material {}
    	      } 
    	      geometry Sphere{} 
    	}
         ]
    }


    To play the sound when the user clicks the shape the following route should be used:
    ROUTE ts.touchTime TO ac.set_startTime

    The sound will play once because the loop field of the AudioClip is set to FALSE.

    Another possibility is to have the sound playing whenever the mouse is over the shape. This can be achieved by the following route:
    ROUTE ts.isOver TO ac.set_loop

    This will cause loop to become TRUE when the TouchSensor output an isOver event with the value TRUE. When the user is no longer over the shape the isOver event from the TouchSensor will output FALSE therefore stopping the sound as soon as the sound's duration/pitch or stopTime are achieved.