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-

Collision Node


If you're not familiar to grouping nodes in VRML see the section Creating Hierarchical Node Structures for general information on grouping.

By default, all objects in the scene are collidable, i.e. you shouldn't be allowed to walk through walls and all that stuff. This is the theory, in practice some browsers still allow you to play ghosts.

So why do you need a collision node if collision is by default detected? Here are a few reasons to use this node:

turn off collision: This may seem a dumb thing to do but it will provide better performance.

provide alternative representations for collision: collision detection is hard work for the browser, complex worlds have lots of faces. This node allows you to provide an alternative graphical representation for collision. If this alternative representation is simpler than the real thing, then collision detection is easier to do. The alternative representation is not drawn, it is only used for collision detection purposes.

do something when collision occurs: The Collision node outputs an event collideTime, which outputs the time of collision. For example, this event can be routed to an AudioClip node to play a sound when the user collides with an object. The example at the bottom of this page shows the code to implement this.

The following fields are present:
  • children which contains all the nodes included in the group.
  • collide, a boolean field which specifies if the children nodes are eligible for collision detection.
  • proxy specifies an alternative geometric representation for collision detection. This field takes as value any node, except those which can only appear inside another node as AudioClip, MovieTexture, geometry nodes, etc...
  • bboxCenter specifies the center of a box that encloses the nodes in the group. The value for this field is a 3D point.
  • bboxSize specifies where the size of a box that encloses the nodes in the group. By default this field has a value of -1 -1 -1, which implies that no box is defined. The values for this field must be greater than or equal to zero. If the children nodes do not fit inside the box defined the results are undefined.
  • Detecting collision in a complex object

    The latter two fields are optional. They can be used by the browser for optimization purposes.

    Syntax:
    Collision {
    children [ ]
    collide TRUE
    proxy NULL
    bboxCenter 0 0 0
    bboxSize -1 -1 -1
    }


    In the following example, when the user collides with the sphere a sound will be heard.

    Example:
    #VRML V2.0 utf8
    DEF col Collision {
    children [
    Sound { source DEF ac AudioClip { loop FALSE pitch 1.0 url "ouch.wav" } }
    Shape {
    appearance Appearance { material Material {}}
    geometry Sphere {}
    }
    ]
    }
    ROUTE col.collideTime TO ac.set_startTime