Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

PlaneSensor Class Reference

The PlaneSensor node is a simple manipulator that maps mouse movement onto a plane, specified by the 'plane' field. More...

Inheritance diagram for PlaneSensor:

Node EventHandler Object List of all members.

Public Member Functions

virtual bool handleEvent (const Event &event)
 Callback function that is implemented by the callee.

Detailed Description

The PlaneSensor node is a simple manipulator that maps mouse movement onto a plane, specified by the 'plane' field.

Input is in normalized device coordinates (NDC), or {x,y} = {[0..1],[0..1]}. Output is a 3D point in world space.

Authoring Interface:

        PlaneSensor {
            field SFVec4f plane 0 1 0 0
            eventIn SFVec2f ndcIn
            eventIn SFVec2f startPosIn
            eventOut SFVec3f transOut
            eventOut SFVec3f worldOut
        }

Parameters:
plane 4-vector defining a plane: first three vector elements is the plane normal, the fourth element is the distance of the plane from the origin. The vector actually represents A, B, C, and D in the plane equation Ax + By + Cz + D = 0.
ndcIn input mouse movement in Normalized Device Coordinates. You can use a WindowSensor and a ValueSensor in tandem to get NDC. Example:
        DEF V ValueSensor { valueOfInterest [ "MOUSEX", "MOUSEY" ] }
        DEF W WindowSensor {}
        function _getMousePos() {
           return SFVec2f( V.value[0] / W.size[0], ( W.size[1] - V.value[1] ) / W.size[1]);
        }
startPosIn send an NDC to this eventIn when you want to reset the PlaneSensor to start at a particular point. Typically this is done at mouse-down: Example:
        DEF MyShape Shape {
           ...
           pickEvent  DO { 
             if ( self.pickEvent == "OVERBUTTONDOWN" ) then
                MyPlaneSensor.startPosIn = self:_getMousePos();
             end
           }
        }
worldOut projection of ndcIn onto given plane
transOut 3D vector relative to the projected startPosIn, suitable for sending to the translation field of an object. Example:
        DEF MyPlaneSensor PlaneSensor {
           plane 0 0 1 0
           transOut DO { 
              MyShape.translation = MyShape.translation + self.transOut;
           } 
        }
Author:
Rick Pasetto
Date:
10/7/2005


Member Function Documentation

virtual bool handleEvent const Event event  )  [virtual]
 

Callback function that is implemented by the callee.

Parameters:
event specifies the time of the event. Event time will be the same for events occurring in the same render phase For example, PREUPDATE, POSTUPDATE, PRERENDER and POSTRENDER event callbacks will all pass the same event time for the same frame. Returning stop Emma from calling the rest of the handlers for this event If you return true, Emma will keep on calling rest of the handlers for this event

Implements EventHandler.


Generated on Sat Apr 1 06:08:09 2006 for Emma Content Development Kit by  doxygen 1.4.3