media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

talk show tell print

web3d-game.vr

web3d-game.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

Web3D/VR

asteroid game

target proto


  
  PROTO TARGET_PROTO [
  eventIn SFTime set_fireTime
  eventIn SFVec3f set_proxyTranslation
  ]
  {
  
  Group  {
  children [
  
  

target animations


  
  DEF TARGET_ANIMATION01 Transform {
  translation 0 3.5 0
  children 
  
  DEF TARGET Transform {
  translation 0 3.5 0
  children 
  Shape {
  appearance Appearance {
  material Material { diffuseColor 1 0 0  } }
  geometry Box { size 1 1 1 } }
  } } 
  
  

target mover


  
  DEF TARGET_HIT_ME_MOVER Transform {
  translation 0 0 0
  children [
  
  DEF TARGET_ANIMATION02 Transform {
  rotation 0 1 0 3.14
  translation 0 4 12
  children [
  
  DEF TARGET_INITIAL_POSITIONER Transform {
  set_translation IS set_proxyTranslation
  children [
  
  DEF TARGET_HIT_ME Transform {
  translation 0 0 0 
  children [
  
  DEF TARGET_HITTER ProximitySensor { size 1 1 1 },
  ]}
  
  ]}
  ]} ## END TARGET_HIT_ME_MOVER
  
  ]}
  
  

timer


  
  DEF Clock2 TimeSensor {
  set_startTime IS set_fireTime
  cycleInterval .5
  loop FALSE
  },
  
  

animations on hit


  
  
  DEF TARGET_HIT_ME_BLAST_SHAPE PositionInterpolator {
  key [ 0.0, 1.0 ]
  keyValue [ 0 8 0, 0 -1 0]
  }
  
  
  DEF TARGETSPEED TimeSensor { cycleInterval 4 loop TRUE }
  
  
  DEF TARGETPATH PositionInterpolator {
  key [ 0, .5, 1, ]
  keyValue [ 3 0 0, -3 0 0, 3 0 0, ]
  }
  
  
  DEF TARGET_DIE_CLOCK TimeSensor { cycleInterval 5 loop FALSE }
  
  
  DEF TARGET_DIE_PATH PositionInterpolator {
  key [ 0.00, 0.04, 0.11, .96, .9999, 1 ]
  keyValue [ 0 3.5  0, 0 7 0, 0 -20 0, 0 0 500, 0 -2.5 -10 0 3.5 0 ]
  }
  ]}
  
  

event routing


  
  ROUTE Clock2.fraction_changed TO TARGET_HIT_ME_BLAST_SHAPE.set_fraction
  ROUTE TARGET_HIT_ME_BLAST_SHAPE.value_changed TO TARGET_HIT_ME.set_translation
  
  ROUTE TARGETSPEED.fraction_changed TO TARGETPATH.set_fraction
  ROUTE TARGETPATH.value_changed TO TARGET_ANIMATION01.set_translation
  ROUTE TARGETPATH.value_changed TO TARGET_HIT_ME_MOVER.set_translation
  
  ROUTE TARGET_HITTER.enterTime TO TARGET_DIE_CLOCK.set_startTime
  ROUTE TARGET_DIE_CLOCK.fraction_changed TO TARGET_DIE_PATH.set_fraction
  ROUTE TARGET_DIE_PATH.value_changed TO TARGET_HIT_ME_MOVER.set_translation
  ROUTE TARGET_DIE_PATH.value_changed TO TARGET.set_translation
  
  } ## End of PROTO
  
  
@- scene

navigation, viewpoint and light


  NavigationInfo { type "NONE" }
  
  DirectionalLight { direction 1.0 -1.5 1}
  Viewpoint { position 0 8 12 orientation 1 0 0 -.45 description "overview"}
  
  

the target


  
  DEF MY_TARGET01  TARGET_PROTO { }
  
  
@- the weapon

weapon shape


  
  DEF WEAPON_SHAPE Transform { 
  children [
  Shape {
  appearance Appearance {
  material Material { diffuseColor .6 .6 .6 } }
  geometry Cone { bottomRadius 1 height .9 } }
  
  DEF LASERBLAST_SHAPE Transform {
  children [
  Shape {
  appearance Appearance {
  material Material { diffuseColor 1 1 0 } }
  geometry Cone { bottomRadius .10 height .6 } }
  ]}
  ]}  
END WEAPON_SHAPE

WEAPON MOVER & GAME BOARD


  
  
  
  Transform {
  translation 0 .5 2
  children [
  Shape {
  appearance Appearance {
  material Material { transparency 1 } }
  geometry Box { size 10 .1 10 } }
  
  
  DEF TOUCH TouchSensor { },
  
  ]}
  
  

END WEAPON MOVER & GAME BOARD

  

laser blast


  
  DEF Clock2 TouchSensor { },

  

  ]}

  

  

END WEAPON MOVER & GAME BOARD


  

laser blast<ë‘|§2 |×.html>TimeSensor { cycleInterval .5 loop FALSE }, DEF LASERBLAST PositionInterpolator { key [ 0, .9999, 1 ] keyValue [ 0 -.5 0, 0 8 0, 0 16 0 ] } ROUTE TOUCH.touchTime TO Clock2.set_startTime ROUTE TOUCH.touchTime TO MY_TARGET01.set_fireTime ROUTE TOUCH.hitPoint_changed TO MY_TARGET01.set_proxyTranslation ROUTE Clock2.fraction_changed TO LASERBLAST.set_fraction ROUTE LASERBLAST.value_changed TO LASERBLAST_SHAPE.set_translation ROUTE TOUCH.hitPoint_changed TO WEAPON_SHAPE.set_translation



(C) A. Eliëns 21/5/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.