This component defines nodes to interact with a pointing device (a mouse).
TouchSensor
allows to catch click events on 3D objects.
Drag sensors allow user to edit a transformation of 3D objects:
PlaneSensor
allows to move objects,
SphereSensor
allows to rotate objects,
and CylinderSensor
allows to rotate objects around a constrained
axis.
See also X3D specification of the Pointing device sensor component.
Contents:
For demos and tests of these features,
see the sensors_pointing_device
subdirectory inside our VRML/X3D demo models.
Catch click events on 3D objects. The main functionality is that it sends touchTime
event when the user "clicked" the geometry that is sibling to the sensor.
See examples/viewport_and_scenes/listen_on_x3d_events/
for a demo how to handle it in Pascal.
Full support, including:
hitTexCoord_changed
event.
You should apply some texture on your shape,
otherwise texture coordinates will not be geneted (and this event
will always generate zero vector).
Note that it's only a single 2D texture coordinate. If you use volumetric 3D textures (from DDS file), the additional texture coordinate components will be ignored. If you use multi-texturing, the additional texture units (above the first) will be ignored.
hitNormal_changed
event. Generates nice smooth normals when
the shape is smooth (e.g. creaseAngle > 0).
Note: Normals output by hitNormal_changed
are in
the shape local coordinate system.
Spec doesn't say in which coordinate system they should be,
please report if you have any idea what is expected /
what other browsers do.
Move geometry by dragging.
Note: when axisRotation
with non-zero rotation is used,
trackPoint_changed
is generated in local sensor coordinates
(with transformation and axisRotation applied),
just like translation_changed
.
Note: that axisRotation
is still useful, it is not
a shortcut for using Transform
with rotation
around the sensor. Reason: wrapping sensor in a Transform
would change it's siblings. So axisRotation
is useful
under our interpretation.
Rotate geometry freely by dragging.
CylinderSensor
(API reference)
Rotate geometry around an axis by dragging.
Note: See PlaneSensor
notes about axisRotation
, they apply also here.
Copyright Michalis Kamburelis and Castle Game Engine Contributors.
This webpage is also open-source and we welcome pull requests to improve it.
We use cookies for analytics. See our privacy policy.