Titania X3D Editor

Bring Colours to Your Life.

Titania v4.3.6

Bring Colours to Your Life.

X3D Reference

Sensing viewer actions

Motivation

You can sense when the viewer's cursor:

  • Is over a shape
  • Has touched a shape
  • Is dragging atop a shape

What can you do:

  • You can trigger animations on a viewer's touch
  • You can enable the viewer to move and rotate shapes

Using action sensors

There are four main action sensor types:

The Anchor node is a special-purpose action sensor with a built-in response

Sensing shapes

  • All action sensors sense all shapes in the same group
  • Sensors trigger when the viewer's cursor touches a sensed shape

Syntax: TouchSensor

A TouchSensor node senses the cursor's touch:

  • isOver - send true/false when cursor over/not over
  • isActive - send true/false when mouse button pressed/released
  • touchTime - send time when mouse button released

XML Encoding

Classic Encoding

A sample use of a TouchSensor node

XML Encoding

Classic Encoding

Syntax: SphereSensor

A SphereSensor node senses a cursor drag and generates rotations as if rotating a ball:

  • isActive - sends true/false when mouse button pressed/released
  • rotation_changed - sends rotation during a drag

XML Encoding

Classic Encoding

Syntax: CylinderSensor

A CylinderSensor node senses a cursor drag and generates rotations as if rotating a cylinder:

  • isActive - sends true/false when mouse button pressed/released
  • rotation_changed - sends rotation during a drag

XML Encoding

Classic Encoding

Syntax: PlaneSensor

A PlaneSensor node senses a cursor drag and generates translations as if sliding on a plane:

  • isActive - sends true/false when mouse button pressed/released
  • translation_changed - sends translations during a drag

XML Encoding

Classic Encoding

Using multiple sensors

Multiple sensors can sense the same shape but ...

If sensors are in the same group:

  • They all respond

If sensors are at different depths in the hierarchy:

  • The deepest sensor responds
  • The other sensors do not respond

Summary

Action sensors sense when the viewer's cursor:

  • is over a shape
  • has touched a shape
  • is dragging atop a shape

Sensors convert viewer actions into events to:

  • Start and stop animations
  • Orient shapes
  • Position shapes

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.