ParallelGraphics
Home  »  Developer Zone  »  Products  »  Cortona3D Viewer  »  VRML Extensions  »  Keyboard Input
Up to VRML Extensions

AdvancedAppearance 

Animated GIF 

BumpMap 

Collision Detection 

CompositeTexture 

CortonaExtrusion 

CubeEnvironment 

DirectX 9.0 Shaders 

Drag & Drop 

EventUtilities 

Flash animations 

FlashMovie 

FontStyle 

Inline Extension 

Interpolator Nodes 

GradientBackground 

Keyboard Input 

Layers and 2D Nodes 

MipMap 

NavigationInfo 

NURBS 

OrderedGroup 

Panel and HTMLText 

QuickTime 

SFVec2f Interpolator 

SphereEnvironment 

Splines 

Three-Dimensional Text 

TextureTransform3 

TransformSensor 

ViewportSensor 

ZGroup 


Subscribe to Newsletter
 


Google Searchsite search:

 

%(domain)s %(domain)s
Install Cortona3D Viewer

Outline3D


Keyboard Input
KbdSensor
Scene size: 567bytes

The KbdSensor node generates events based on input from a keyboard.

Click anywhere in the 3D window and press any alphanumeric keys.


Node description
KbdSensor {
 exposedField	SFBool	enabled TRUE
 exposedField	SFBool	isActive FALSE
 eventOut		SFInt32	keyDown
 eventOut		SFInt32	keyUp
}
 
enabled indicates whether the sensor is currently paying attention to a keyboard input. If enabled receives TRUE and isActive is TRUE, the sensor reacts on input from a keyboard. In this case, the user cannot navigate in the 3D window using keyboard commands.

 
isActive allows to control the sensor. If isActive receives a TRUE event, the sensor processes all keyboard input. Otherwise, the input is treated with a browser.

 
keyDown and keyUp events generate 32-bit value containing the character code of the key that was pressed or released. The primary two bytes specify the virtual-key code of the nonsystem key, and the secondary - key-state flags.



Example
#VRML V2.0 utf8
NavigationInfo {
 type "EXAMINE"
}
Background {
 skyColor [1 1 1]
}
DEF KS KbdSensor {
 isActive TRUE
}
Shape {
 geometry DEF TXT Text {
  string ["?"]
  fontStyle FontStyle	{
  justify ["MIDDLE", "MIDDLE"]
  family "TYPEWRITER"
  style "BOLD"
  size 4
  }
 }
 appearance Appearance {
  material Material {
   diffuseColor 0.02 0.38 0.61
  }
 } 
}
DEF SCR Script	{
 directOutput TRUE
 eventIn SFInt32 go
 field SFNode TXT USE TXT
 field MFString string [""]
 url ["javascript:
  function go(val,ts){
   string[0]=
    String.fromCharCode(val.toString());
   TXT.string=string;
  }
  "]
}
ROUTE KS.keyDown TO SCR.go

You can see this example in Cortona at top left corner of this page.




Last updated: Fri, 03 Jul 2009
© 2000-2009 ParallelGraphics. All rights reserved. Terms of use.