Bitbybit Docs
    Preparing search index...

    Class BabylonGizmoManager

    The gizmo manager owns the on-screen manipulators for one attached mesh at a time and, by default, attaches them to whatever the pointer clicks. Create it with the gizmos you want enabled, then read the individual position, rotation, scale and bounding box gizmos from it to tune them.

    Index

    Constructors

    create

    • Creates a gizmo manager with the chosen gizmos enabled: position arrows, rotation rings, scale handles and a bounding box.

      With usePointerToAttachGizmos true the gizmos attach to the mesh the user clicks, limited to attachableMeshes when that list is given; clearGizmoOnEmptyPointerEvent detaches them on a click into empty space.

      Parameters

      • inputs: CreateGizmoDto

        Which gizmos to enable, the attachable meshes, the pointer behavior and the scale ratio

      Returns GizmoManager

      The gizmo manager

      const manager = bitbybit.babylon.gizmo.manager.createGizmoManager({ positionGizmoEnabled: true, rotationGizmoEnabled: true, scaleGizmoEnabled: false, boundingBoxGizmoEnabled: false, attachableMeshes: [], usePointerToAttachGizmos: false, clearGizmoOnEmptyPointerEvent: false, scaleRatio: 1 });
      bitbybit.babylon.gizmo.manager.attachToMesh({ gizmoManager: manager, mesh });

    get

    • Reads the position gizmo of a manager, the arrows that drag the mesh along an axis, for tuning its snapping and planes; it exists only when position gizmos are enabled.

      Parameters

      Returns IPositionGizmo

      The position gizmo

      const positionGizmo = bitbybit.babylon.gizmo.manager.getPositionGizmo({ gizmoManager: manager });
      bitbybit.babylon.gizmo.positionGizmo.snapDistance({ positionGizmo, snapDistance: 1 });
    • Reads the rotation gizmo of a manager, the rings that turn the mesh around an axis, for tuning its snapping and sensitivity; it exists only when rotation gizmos are enabled.

      Parameters

      Returns IRotationGizmo

      The rotation gizmo

      const rotationGizmo = bitbybit.babylon.gizmo.manager.getRotationGizmo({ gizmoManager: manager });
      bitbybit.babylon.gizmo.rotationGizmo.snapDistance({ rotationGizmo, snapDistance: 0.2 });
    • Reads the scale gizmo of a manager, the handles that stretch the mesh along an axis, for tuning its snapping and sensitivity; it exists only when scale gizmos are enabled.

      Parameters

      Returns IScaleGizmo

      The scale gizmo

    • Reads the bounding box gizmo of a manager, the frame with corner handles for scaling and rotating, for tuning its handles and snapping; it exists only when bounding box gizmos are enabled.

      Parameters

      Returns IBoundingBoxGizmo

      The bounding box gizmo

    update

    • Shows the manager's enabled gizmos on a mesh so the user can manipulate it; any mesh attached before is released.

      Parameters

      Returns GizmoManager

      The same gizmo manager

      bitbybit.babylon.gizmo.manager.attachToMesh({ gizmoManager: manager, mesh });
      
    • Hides the manager's gizmos by releasing the mesh they were attached to.

      Parameters

      Returns GizmoManager

      The same gizmo manager

      bitbybit.babylon.gizmo.manager.detachMesh({ gizmoManager: manager });