HKScene

@objc
public class HKScene : NSObject

Scene object

  • The title of the current loaded scene.

    Declaration

    Swift

    @objc
    public var title: String
  • The description of the current loaded scene.

    Declaration

    Swift

    @objc
    public var text: String
  • The description of the current loaded scene.

    Declaration

    Swift

    @objc
    public var textSections: [[String : String]]
  • A flat unordered list of visible objects in the current scene

    Declaration

    Swift

    @objc
    public var objectIDs: [String]
  • A map of objectIDs to display names

    Declaration

    Swift

    @objc
    public var objects: [String : String]
  • A map of annotation IDs to Annotation objects

    Declaration

    Swift

    @objc
    public var annotations: [String : HKAnnotation]
  • Brings up the built-in iOS share UI with the current contents of the view

    Declaration

    Swift

    @objc
    public func share(from: CGRect)
  • Eventually calls a callback returning a UIImage

    Declaration

    Swift

    @objc
    public func screenshot()
  • Reset the camera and objects to the current scene/chapter’s original state

    Declaration

    Swift

    @objc
    public func reset()
  • Change the background style with two specified colors

    Declaration

    Swift

    @objc
    public func setBackgroundColor(top: UIColor, bottom: UIColor, type: BackgroundOptions = .radial)

    Parameters

    top

    Primary color

    bottom

    Secondary color

    bgType

    (optional) Background style (BackgroundOptions.radial or BackgroundOptions.linear, default is .radial)

  • Turn xray mode ON or OFF in the current scene

    Declaration

    Swift

    @objc
    public func xray(enabled: Bool)

    Parameters

    enabled

    A boolean to turn xray mode ON or OFF

  • Turn isolate mode ON or OFF in the current scene

    Declaration

    Swift

    @objc
    public func isolate(enabled: Bool)

    Parameters

    enabled

    A boolean to turn isolate mode ON or OFF

  • Turn dissect mode ON or OFF in the current scene

    Declaration

    Swift

    @objc
    public func dissect(enabled: Bool)

    Parameters

    enabled

    A boolean to turn dissect mode ON or OFF

  • Undo the last dissect

    Declaration

    Swift

    @objc
    public func undo()
  • Undocumented

    Declaration

    Swift

    @objc
    public func isXray(objectID: String) -> Bool
  • Undocumented

    Declaration

    Swift

    @objc
    public func setXray(objectID: String, enable: Bool)
  • Undocumented

    Declaration

    Swift

    @objc
    public func setPickable(objectID: String, enable: Bool)
  • Select an object programatically

    Declaration

    Swift

    @objc
    public func selectObject(objectID: String)

    Parameters

    objectID

    the object you want to select

  • Select an object programatically - Parameter objectID: the object you want to select

    Declaration

    Swift

    @objc
    public func selectObjectWithGroup(objectID: String, group: [String])
  • Select an object programatically - Parameter objectID: the object you want to select

    Declaration

    Swift

    @objc
    public func selectGroup(group: [String])
  • Deselect all objects in the scene

    Declaration

    Swift

    @objc
    public func undoSelections()
  • Change the object highlight color

    Declaration

    Swift

    @objc
    public func setHighlightColor(color: UIColor)

    Parameters

    color

    Selected objects are yellow by default, set this to use a different color

  • Disable object highlighting

    Declaration

    Swift

    @objc
    public func disableHighlight()
  • Enable object highlighting

    Declaration

    Swift

    @objc
    public func enableHighlight()
  • Highlight an object

    Declaration

    Swift

    @objc
    public func highlightObject(objectid: String)

    Parameters

    objectid

    object to highlight

  • unHighlight an object

    Declaration

    Swift

    @objc
    public func unhighlightObject(objectid: String)

    Parameters

    objectid

    object to unhighlight

  • Prevent objects from being selected

    Declaration

    Swift

    @objc
    public func disablePicking()
  • Allow objects to be selected

    Declaration

    Swift

    @objc
    public func enablePicking()
  • Enables labels to appear when an object is selected, this is the default behavior, unless disabled

    Declaration

    Swift

    @objc
    public func showLabels()
  • Hides all object labels and disables future labels from appearing on selected objects

    Declaration

    Swift

    @objc
    public func hideLabels()
  • Get an object’s screen position

    Declaration

    Swift

    @objc
    public func getObjectPosition(objectID: String) -> [Double]

    Parameters

    objectID

    A valid object ID string

    Return Value

    the screen position of the center of the object with the given ID as [x,y]

  • Shows all annotations in the current scene, and enables future annotations to appear, this is the default behavior

    Declaration

    Swift

    @objc
    public func showAnnotations()
  • Hides all annotations and disables future annotations from appearing, until showAnnotations() is called This call starts a repeating timer which polls the scene’s annotations for screen coordinates so the app can draw them

    Declaration

    Swift

    @objc
    public func hideAnnotations()