IBM TJ Watson Research

IBMPlaneSensor2D

IBMPlaneSensor2D.mp4

Description

A Rectangle shape can be dragged by use of a PlaneSensor2D whose translation_changed output is routed to the translation field of the Transform2D containing the rectangle. The check boxes at the top left of the screen allow the PlaneSensor2D's enabled and autoOffset fields to be set true or false. When disabled the rectangle cannot be dragged.

The translation_changed, trackPoint_changed and offset from the PlaneSensor2D are routed via Valuators, to convert the values to strings, so they can be displayed in Text nodes at the top of the screen. Offset will be set after dragging, when the mouse is released, but only when autoOffset is set true.

The radio buttons at the bottom of the screen allow the PlaneSensor2D's minPosition and maxPosition to be set. When a button is selected the translation of the rectangle is set back to (0,0) and the offset is set back to (0,0) too so its back in the center and will commence dragging from there. There are six min/max position values which affect the bounds over which the rectangle can be dragged:

The translation_changed will reflect the above limits as can be seen by dragging the shape and observing the values. When bounded the x and/or y value should never go outside of any bounds that have been set via the minPosition and maxPosition.

Screenshot

Snapshot taken during dragging



Back to main index