SDK for Unity
The PhantomSettings script is where you assign the settings you'd like to use in a scene. Every scene requires a PhantomSettings script.
The settings which need to be linked to PhantomSettings are:
Contains parameters for tweaking / configuring Object Recognition.
Contains references for assigning compute shaders.
Contains parameters for tweaking / configuring Scanning.
Contains parameters for tweaking / configuring Meshing.
Default presets for all these settings should exist in PhantomEngine by default. These use our recommended settings, but you can create your own settings for specialised applications.
The PScene script is essential for any Unity scene in which you wish to use PhantomEngine.
It initialises the OctreeManager and stores information about the device's sensor, such as its field of view and range. It also updates the engine's internal copy of the camera background texture. Additionally, PScene manages an instance of "PhantomScene" in a UnityEngine context, allowing you to access the current PhantomScene.
PScene is a singleton and can be accessed from any script as long as you have an instance of the PScene script in your scene. Call PScene.Instance to get a reference.
While you may not interact with this script directly, it is required to run the essential functions of other modules.
The OctreeManager is a data structure that stores spatial information about a scene. Typically, information is added to the OctreeManager by Scanning and read from the OctreeManager by Meshing.
OctreeManager is a singleton and can be accessed from any script as long as you have an instance of the PScene script in your scene. Call OctreeManager.Instance to get a reference.
You can add points to the OctreeManager using AddPoint() and AddPoints(), and check to see if points are contained within the OctreeManager using Contains().
The OctreeManager can manually be cleared using Clear(), and you can resize the Octrees within the OctreeManager using Resize(), but keep in mind this will also clear the OctreeManager of its data.
The GlobalPositioningService script manages and automatically updates the device's global position using the device's location service (if available).
You can subscribe to the GlobalPositionService.PositionUpdated event to recieve updates every time the device's position is updated.
The script will only update the device's position while enabled.