Aracılığıyla paylaş


SpacePin Class

Definition

Component helper for pinning the world locked space at a single reference point.

public class SpacePin : UnityEngine.MonoBehaviour
type SpacePin = class
    inherit MonoBehaviour
Public Class SpacePin
Inherits MonoBehaviour
Inheritance
UnityEngine.MonoBehaviour
SpacePin
Derived

Remarks

This component captures the initial pose of its gameObject, and then a second pose. It then adds that pair to the WorldLocking Alignment Manager. The manager then negotiates between all such added pins, based on the current head pose, to generate a frame-to-frame mapping aligning the Frozen Space, i.e. Unity's Global Space, such that the pins match up as well as possible. Another way to phrase this is: Given an arbitrary pose (the "modeling pose"), and a pose aligned somehow to the real world (the "world locked pose"), apply a correction to the camera such that a virtual object with coordinates of the modeling pose will appear overlaid on the real world at the position and orientation described by the locked pose. For this component, the locked pose must come in via one of the following three APIs: SetFrozenPose(Pose) with input pose in Frozen Space, which includes pinning. SetSpongyPose(Pose) with input pose in Spongy Space, which is the space of the camera's parent, and is the same space the camera moves in, and that native APIs return values in (e.g. XR). SetLockedPose(Pose) with input pose in Locked Space, which is the space stabilized by the Frozen World engine DLL but excluding pinning. Note that since the Frozen Space is shifted by the AlignmentManager, calling SetFrozenPose(p) with the same Pose p twice is probably an error, since the Pose p would refer to different a location after the first call.

Constructors

SpacePin()

Properties

AlignmentManager

Accessor for overriding the AlignmentManager from script.

AnchorId

This wrapper for the anchorId is because the anchorId has to be stored as a ulong, which is the base class for the AnchorId enum. Unity only supports int-based enums, so will complain on serialization etc. for the ulong based AnchorId.

AnchorName

Provide a unique anchor name. This is used for persistence.

FragmentId

Id for fragment this pin belongs in.

LockedPose

Accessor for world locked pose for derived classes.

Manager

Read only access to manager dependency from derived classes.

ModelingPoseGlobal

First of the pair of poses submitted to alignment manager for alignment.

ModelPositionSource

Where to find model space position on target. Transform is preferable, but if transforms are baked in, renderer or collider may be more appropriate.

PinActive

Whether this space pin is in active use pinning space

RestorePoseLocal

Pose to restore after manipulation (if any).

Methods

ExtractModelPose()
ExtractModelPoseFromCollider()
ExtractModelPoseFromRenderer()
ExtractModelPoseFromTransform()
ForceAttachment()

Ensure that there is an attachment, and it is positioned up to date.

GetModelPoseFromGlobalPosition(Vector3)
OnDestroy()

On destroy, unregister for the loaded event.

OnLocationUpdate(Pose)

Callback for refit operations. Apply adjustment transform to locked pose.

PushAlignmentData(IAlignmentManager)

Communicate the data from this point to the alignment manager.

ReleaseAttachment()

Dispose of any previously created attachment point.

Reset()

Go back to initial state, including removal of self-artifacts from alignment manager.

ResetModelingPose()

Reset the modeling pose to the current transform.

RestoreOnLoad()

Callback on notification of the alignment manager's database to check if this preset has been persisted, and restore it to operation if it has.

SendAlignmentData(IAlignmentManager)

Notify the manager that all necessary updates have been submitted and are ready for processing.

SetFrozenPose(Pose)

Transform pose to Locked Space and pass through.

SetLockedPose(Pose)

Record the locked pose and push data to the manager.

SetSpongyPose(Pose)

Transform pose to Locked Space and pass through.

Start()

Applies to