Course Index Section Start Previous Slide Next Slide 9

One Oddity of PlaneSensors

How to "invert" a PlaneSensor to make it useful:

To rotate a drag sensor, we must introduce a transformation to hold the rotation. If this transformation is placed directly over the drag sensor, then the surface-area geometry will no longer be a sibling, and the drag sensor will become useless. To work around this shortcoming, create a transform over the geometry. Then rotate the drag sensor's parent transform (which will also rotate the geometry), and then counter-rotate the geometry's parent transformation.

Transform {
  children [
    PlaneSensor{}
    Transform {
      children [
        Shape { geometry Box {} }
      ]
  ]
}