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

Z6y ];CƼ.YN%s*[Tlש-Ϭ "AcBёd<)Hu)n4ݛ0cյ~\׷B [튂OX(<~X1C]Kl:/e}ݝ8y6K9fԏu{jS[@O4t<^UմGiׯiZ¹[_Dk- Wf8{PF{F/*T  b ,n[tfQҖñA$xs1 y̧w2B1o5WzN{Ubߦ(avώ\C I5x)&gA{lJċ&cd12h@S=\7K(sRQ`EF@IN ~Ur]mohV(ƷyRL }|dJ!lvKO܁d,^M ’&^z!K0lɆB0I0;crUuq)gYЁTh+Qb$m%鬩,80Ds m2cc=3ϜG㠍E3u8! (IӗOxzVng_(uNIA.D7Q@x'b U'[\?I^{͵у28R~L|qXwSEN#zs;hf=g"^yKϷ@QT.EH?`nVv m?s! U٤0j-BH?6^Y",Ry0C)sg,k;WWļgQ`]F-E_߿o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;}4GS91؝M{v)39[}ܜZh^7%67sUJzn4X4S=jxmo=sJyR%munh^oS%~,UJ ^zIɿhD>}|}c"l!45d8_nZ"-`jl , ]\`]ŕpq'C q=>6i:>6dJ2n{wXg%|37p$1Tˋ͢ݸb-`'?8uA[٧Y\['{Hmr'w.a: RNh{蟊O9b]ko)zRVvc7a4],@ ņ"Ud{̐C:"h8;g sS)KGJb4z M`اfiƯںBV7`>^XG)]3EOS閶,gx#6&rLdSV'wOP.Djú[,Jvlźc]Civhq$5krL7gǙ5?c2O(ٌĉk79sۑ&zV#FuHAB2 6KTI9NF<27ZWDZ?x 4M܏AʕsC&ܮiB[K 4cN̾JINڒ~:IMֈ ^ҷUSj/ Ø{e/4K蚫9-QYmsJҲ0Σ$ xJ{65VaaWo߼|s3y{O0 %^mH8Vs1W ̓1`S֊y L'^>Qʛ\Ǟ,-.m]i[_&3?Ӫj/ iikV$ka<x m;}H΂mSqβg3=rMfo`p% hRq =3u Z q5CkW|Iߙ2SyB艞fjSB_OΠrՏagx*- AjZMԲf,``zq繒J*2widzp5DݱY&q!LJY,5 x J/wE0iAAz8s_x`Y Ll@[&CP alx e-$kp8kH_ևMlm23Rw jCS'U^'hve_`.yo.^\"u1v| UڳWv\Huy!|a Nev*)X|SSG%͒y8_Gnd! ߬r¶UmՕ~jE{r/YvI!IQt[|xaηÎ<S/Od4R5UI+!}xl/rt-EE>)vų^tysy IL(~y~/Y)СQBל5͵C%zpK-mf.0uΰ^3>e~j;O!F'r:ht2{:f{-+J-#]Ɨ;>/~/fJƓz-\Seb8?Y::>B"H-"9wK~Ä[N'ɏdPk}П27P|8̩UǴŠLG#O 08k

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