FlickSensor

Open FlickSensor.wrl
Open FlickSensor-SingleLevel.wrl

Description

This test case contains two shapes in nested transforms, each nesting level containing
a TouchSensor, a PlaneSensor and a FlickSensor. It prints out the events that these six
sensor nodes generate.

Transform
{
    children Transform
    {
        children
        [
            DEF SensTchO TouchSensor {}
            DEF SensPlnO PlaneSensor {}
            DEF SensFlkO FlickSensor {}

            Shape { <A big blue box> }

            Transform
            {
                children
                [
                    DEF SensTchI TouchSensor {}
                    DEF SensPlnI PlaneSensor {}
                    DEF SensFlkI FlickSensor {}

                    Shape { <A small green sphere> }
                ]
            }
        ]
    }
}

The FlickBall test case demonstrates use of a FlickSensor.

Usage

Depending on where you flicked, the console contains something similar to one of
the following. The flick related messages are in bold.

Console output if flicked on the blue box (outer shape):

------------------------------------
Outer TouchSensor: isOver yes
Outer TouchSensor: hitNormal 1 -1.34615e-009 -3.29599e-009
Outer TouchSensor: hitPoint 1 -0.0838047 0.247011
Outer TouchSensor: hitTexCoord 0.376495 0.458098
Global events: Flick Right
 
Outer FlickSensor: hitNormal 1 -1.34615e-009 -3.29599e-009
Outer FlickSensor: hitPoint 1 -0.0969546 0.0299766
Outer FlickSensor: hitTexCoord 0.485012 0.451523
Outer FlickSensor: flick Right
Outer FlickSensor: flickRightTime
 
Outer TouchSensor: hitNormal 1 -1.34615e-009 -3.29599e-009
Outer TouchSensor: hitTexCoord 0.376495 0.458098
 
Outer TouchSensor: hitNormal 1 -1.34615e-009 -3.29599e-009
Outer TouchSensor: hitTexCoord 0.376495 0.458098

Outer TouchSensor: hitNormal 1 -1.34615e-009 -3.29599e-009
Outer TouchSensor: hitPoint 1 -0.0831453 0.251822
Outer TouchSensor: hitTexCoord 0.374089 0.458427
 
Outer TouchSensor: hitNormal 1 -1.34615e-009 -3.29599e-009
Outer TouchSensor: hitPoint 1 -0.0824862 0.256628
Outer TouchSensor: hitTexCoord 0.371686 0.458757
 
Outer TouchSensor: isOver no

Console output if flicked on the green sphere (inner shape):

------------------------------------
Inner TouchSensor: isOver yes
Inner TouchSensor: hitNormal 0.628642 0.702593 0.333426
Inner TouchSensor: hitPoint 0.302251 0.337807 0.160311
Inner TouchSensor: hitTexCoord 0.674861 0.746631
Global events: Flick Right
 
Inner FlickSensor: hitNormal 0.679745 0.730448 -0.0662773
Inner FlickSensor: hitPoint 0.325133 0.349385 -0.0317016
Inner FlickSensor: hitTexCoord 0.771134 0.757175
Inner FlickSensor: flick Right
Inner FlickSensor: flickRightTime
 
Inner TouchSensor: hitNormal 0.628642 0.702593 0.333426
Inner TouchSensor: hitTexCoord 0.674861 0.746631
 
Inner TouchSensor: hitNormal 0.628642 0.702593 0.333426
Inner TouchSensor: hitTexCoord 0.674861 0.746631
 
Inner TouchSensor: hitNormal 0.628642 0.702593 0.333426
Inner TouchSensor: hitTexCoord 0.674861 0.746631
 
Inner TouchSensor: isOver no


Console output if flicked outside of any shape:

------------------------------------
Global events: Flick Right