Inheritance diagram for PlaneSensor:

Public Member Functions | |
| virtual bool | handleEvent (const Event &event) |
| Callback function that is implemented by the callee. | |
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
}
| 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;
}
}
|
|
|
Callback function that is implemented by the callee.
Implements EventHandler. |
1.4.3