|
|
VRML Script Tutorial
Full list
VRML Interactive Tutorial
Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Appearance
Let there be Light
Materials with Colored Lights
Hierarchical Node Structures
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Interpolators
Let the Music Play
Bindable Nodes
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes
|
|
|
|
CylinderSensor Node
The CylinderSensor node maps the mouse movement into the a conceptual cylinder,
rotating the shapes in the Y axis of its local coordinate system. See Dragging
Sensors for more information on this type of sensors. This node allows
you to limit the draggin operation between two angles. The offset field
is relative to the X axis.
In addition to the fields which are common to all dragging sensors, this
node has the following fields:
maxAngle which specifies the maximum rotation.
minAngle which specifies the minimum rotation.
diskAngle: I still haven't found how this field affects the behaviour
of the node
Note: if maxAngle is smaller than minAngle, then the rotation
is not limited.. By default the rotation is not limited.
Syntax:
|
PlaneSensor { |
enabled TRUE
offset 0
autoOffset TRUE
maxAngle -1
minAngle 0
diskAngle 0.262
|
} |
|
In addition to the exposed fields
presented in the syntax the CylinderSensor node generates the following
events (see Dragging
Sensors for a description of their meaning):
isActive (boolean)
rotation_changed (3D vector plus an angle, the 3D vector is
the Y axis of the local coordinate system)
trackPoint_changed (3D point)
The following example uses a CylinderSensor to rotate a Cone
limited between 0 and 1.57 (+- 90 degrees).
First one needs to create a group node which will include both the sensor
and a Transform node containg
a Cone geometry.
Example:
-
#VRML V2.0 utf8
Group {
- children [
DEF cs CylinderSensor {
- minAngle 0
- maxAngle 1.57
}
DEF tr Transform {
- children
Shape {geometry Cylinder {}}
}
]
}
Now we need to create a route between
the eventOut rotation_changed
from the CylinderSensor to the exposed
field rotation of the Transform node. The route to achieve this
is:
ROUTE cs.rotation_changed TO tr.set_rotation
Note: On the VRML example provided the axes are not inside the same group
as the sensor.
|