Titania X3D Editor

Bring Colours to Your Life.

Titania v4.3.6

Bring Colours to Your Life.

X3D Reference

KeySensor

KeySensor

KeySensor generates events as the user presses keys on the keyboard. Supports notion of "keyboard focus".

The KeySensor node belongs to the KeyDeviceSensor component and its container field is children. It is available since X3D version 3.0 or later.

Hierarchy

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Metadata are not part of the X3D world and not interpreted by the X3D browser, but they can be accessed via the ECMAScript interface.

SFBool [in, out] enabled TRUE

Enables/disables node operation.

SFBool [out] controlKey

ControlKey generates true event when pressed, false event when released.

SFBool [out] shiftKey

ShiftKey generates true event when pressed, false event when released.

SFBool [out] altKey

AltKey generates true event when pressed, false event when released.

SFInt32 [out] actionKeyPress

Action key press gives following values: F1..F12 = 1...12 HOME=13 END=14 PGUP=15 PGDN=16 UP=17 DOWN=18 LEFT=19 RIGHT=20.

SFInt32 [out] actionKeyRelease

Action key release gives following values: F1..F12 = 1...12 HOME=13 END=14 PGUP=15 PGDN=16 UP=17 DOWN=18 LEFT=19 RIGHT=20.

SFString [out] keyPress

Events generated when user presses character-producing keys on keyboard produces integer UTF-8 character values.

SFString [out] keyRelease

Events generated when user releases character-producing keys on keyboard produces integer UTF-8 character values.

SFBool [out] isActive

When a key is pressed, the KeySensor sends an isActive event with value true. Once the key is released, the KeySensor sends an isActive event with value false.

Example

KeySensor

XML Encoding

Classic Encoding

JSON Encoding

Browser Compatibility

Titania X_ITE
yes yes

External Links

Cookies and other Technologies

By clicking »Accept« or continuing to use the site, you agree to the use of CREATE3000 and third-party cookies and other similar technologies to enhance your browsing experience, analyze and measure your engagement with our content, and provide more relevant ads on CREATE3000 websites and others. Learn more about cookies. You can withdraw your consent at any time.